import unittest

from bitbucket.bitbucket import Bitbucket
from bitbucket.tests.private import USERNAME, PASSWORD

TEST_REPO_SLUG = 'test_bitbucket_api'


class AuthenticatedBitbucketTest(unittest.TestCase):
    """ Bitbucket test base class for authenticated methods."""
    def setUp(self):
        """Creating a new authenticated Bitbucket..."""
        self.bb = Bitbucket(USERNAME, PASSWORD)
        # Create a repository.
        success, result = self.bb.repository.create(TEST_REPO_SLUG, has_issues=True)
        # Save repository's id
        assert success
        self.bb.repo_slug = result[u'slug']

    def tearDown(self):
        """Destroying the Bitbucket..."""
        # Delete the repository.
        self.bb.repository.delete()
        self.bb = None


class BitbucketAuthenticatedMethodsTest(AuthenticatedBitbucketTest):
    """ Testing Bitbucket annonymous methods."""

    def test_get_tags(self):
        """ Test get_tags."""
        success, result = self.bb.get_tags()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)

    def test_get_branches(self):
        """ Test get_branches."""
        success, result = self.bb.get_branches()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)

import unittest

from bitbucket.bitbucket import Bitbucket
from bitbucket.tests.private import USERNAME, PASSWORD

TEST_REPO_SLUG = 'test_bitbucket_api'


class AuthenticatedBitbucketTest(unittest.TestCase):
    """ Bitbucket test base class for authenticated methods."""
    def setUp(self):
        """Creating a new authenticated Bitbucket..."""
        self.bb = Bitbucket(USERNAME, PASSWORD)
        # Create a repository.
        success, result = self.bb.repository.create(TEST_REPO_SLUG, has_issues=True)
        # Save repository's id
        assert success
        self.bb.repo_slug = result[u'slug']

    def tearDown(self):
        """Destroying the Bitbucket..."""
        # Delete the repository.
        self.bb.repository.delete()
        self.bb = None


class BitbucketAuthenticatedMethodsTest(AuthenticatedBitbucketTest):
    """ Testing Bitbucket annonymous methods."""

    def test_get_tags(self):
        """ Test get_tags."""
        success, result = self.bb.get_tags()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)
        # test with invalid repository name
        success, result = self.bb.get_tags(repo_slug='azertyuiop')
        self.assertFalse(success)

    def test_get_branches(self):
        """ Test get_branches."""
        success, result = self.bb.get_branches()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)
        # test with invalid repository name
        success, result = self.bb.get_branches(repo_slug='azertyuiop')
        self.assertFalse(success)

Update BitbucketAuthenticatedMethodsTest's test_get_tags and test_get_branches methods.
Update BitbucketAuthenticatedMethodsTest's test_get_tags and test_get_branches methods.

Signed-off-by: Baptiste Millou <1cfd48a9a65a966defdcd720f66cd790094000c4@smoothie-creative.com>

  import unittest
  
  from bitbucket.bitbucket import Bitbucket
  from bitbucket.tests.private import USERNAME, PASSWORD
  
  TEST_REPO_SLUG = 'test_bitbucket_api'
  
  
  class AuthenticatedBitbucketTest(unittest.TestCase):
      """ Bitbucket test base class for authenticated methods."""
      def setUp(self):
          """Creating a new authenticated Bitbucket..."""
          self.bb = Bitbucket(USERNAME, PASSWORD)
          # Create a repository.
          success, result = self.bb.repository.create(TEST_REPO_SLUG, has_issues=True)
          # Save repository's id
          assert success
          self.bb.repo_slug = result[u'slug']
  
      def tearDown(self):
          """Destroying the Bitbucket..."""
          # Delete the repository.
          self.bb.repository.delete()
          self.bb = None
  
  
  class BitbucketAuthenticatedMethodsTest(AuthenticatedBitbucketTest):
      """ Testing Bitbucket annonymous methods."""
  
      def test_get_tags(self):
          """ Test get_tags."""
          success, result = self.bb.get_tags()
          self.assertTrue(success)
          self.assertIsInstance(result, dict)
+         # test with invalid repository name
+         success, result = self.bb.get_tags(repo_slug='azertyuiop')
+         self.assertFalse(success)
  
      def test_get_branches(self):
          """ Test get_branches."""
          success, result = self.bb.get_branches()
          self.assertTrue(success)
          self.assertIsInstance(result, dict)
+         # test with invalid repository name
+         success, result = self.bb.get_branches(repo_slug='azertyuiop')
+         self.assertFalse(success)
  
Update BitbucketAuthenticatedMethodsTest's test_get_tags and test_get_branches methods.
## Code Before:
import unittest

from bitbucket.bitbucket import Bitbucket
from bitbucket.tests.private import USERNAME, PASSWORD

TEST_REPO_SLUG = 'test_bitbucket_api'


class AuthenticatedBitbucketTest(unittest.TestCase):
    """ Bitbucket test base class for authenticated methods."""
    def setUp(self):
        """Creating a new authenticated Bitbucket..."""
        self.bb = Bitbucket(USERNAME, PASSWORD)
        # Create a repository.
        success, result = self.bb.repository.create(TEST_REPO_SLUG, has_issues=True)
        # Save repository's id
        assert success
        self.bb.repo_slug = result[u'slug']

    def tearDown(self):
        """Destroying the Bitbucket..."""
        # Delete the repository.
        self.bb.repository.delete()
        self.bb = None


class BitbucketAuthenticatedMethodsTest(AuthenticatedBitbucketTest):
    """ Testing Bitbucket annonymous methods."""

    def test_get_tags(self):
        """ Test get_tags."""
        success, result = self.bb.get_tags()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)

    def test_get_branches(self):
        """ Test get_branches."""
        success, result = self.bb.get_branches()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)

## Instruction:
Update BitbucketAuthenticatedMethodsTest's test_get_tags and test_get_branches methods.
## Code After:
import unittest

from bitbucket.bitbucket import Bitbucket
from bitbucket.tests.private import USERNAME, PASSWORD

TEST_REPO_SLUG = 'test_bitbucket_api'


class AuthenticatedBitbucketTest(unittest.TestCase):
    """ Bitbucket test base class for authenticated methods."""
    def setUp(self):
        """Creating a new authenticated Bitbucket..."""
        self.bb = Bitbucket(USERNAME, PASSWORD)
        # Create a repository.
        success, result = self.bb.repository.create(TEST_REPO_SLUG, has_issues=True)
        # Save repository's id
        assert success
        self.bb.repo_slug = result[u'slug']

    def tearDown(self):
        """Destroying the Bitbucket..."""
        # Delete the repository.
        self.bb.repository.delete()
        self.bb = None


class BitbucketAuthenticatedMethodsTest(AuthenticatedBitbucketTest):
    """ Testing Bitbucket annonymous methods."""

    def test_get_tags(self):
        """ Test get_tags."""
        success, result = self.bb.get_tags()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)
        # test with invalid repository name
        success, result = self.bb.get_tags(repo_slug='azertyuiop')
        self.assertFalse(success)

    def test_get_branches(self):
        """ Test get_branches."""
        success, result = self.bb.get_branches()
        self.assertTrue(success)
        self.assertIsInstance(result, dict)
        # test with invalid repository name
        success, result = self.bb.get_branches(repo_slug='azertyuiop')
        self.assertFalse(success)
