Source code for bitbucket.tests.private.issue_comment

# -*- coding: utf-8 -*-
from bitbucket.tests.private.private import AuthenticatedBitbucketTest

[docs]class IssueCommentAuthenticatedMethodsTest(AuthenticatedBitbucketTest): """ Testing bitbucket.issue.comments methods."""
[docs] def setUp(self): """ Add an issue to the test repository and save it's id.""" super(IssueCommentAuthenticatedMethodsTest, self).setUp() # Create an issue. success, result = title=u'Test Issue Bitbucket API', content=u'Test Issue Bitbucket API',, status=u'new', kind=u'bug',) # Save latest issue's id assert success = result[u'local_id']
[docs] def tearDown(self): """ Delete the issue.""" super(IssueCommentAuthenticatedMethodsTest, self).tearDown()
[docs] def test_all(self): """ Test get all issue comments.""" success, result = self.assertTrue(success) self.assertIsInstance(result, list)
def _create_issue_comment(self): content = u'Test Issue comment Bitbucket API' # Test create an issue comment success, result = content=content) self.assertTrue(success) self.assertIsInstance(result, dict) self.assertEqual(result[u'content'], content) # Save latest issue comment's id self.comment_id = result[u'comment_id'] def _get_issue_comment(self): # Test get an issue comment. success, result = self.assertTrue(success) self.assertIsInstance(result, dict) # Test get an invalid issue comment. success, result = self.assertFalse(success) def _update_issue_comment(self): # Test issue comment update. test_content = 'Test content' success, result = comment_id=self.comment_id, content=test_content) self.assertTrue(success) self.assertIsInstance(result, dict) self.assertEqual(test_content, result[u'content']) def _delete_issue_comment(self): # Test issue comment delete. success, result = comment_id=self.comment_id) self.assertTrue(success) self.assertEqual(result, '') success, result = self.assertFalse(success)
[docs] def test_CRUD(self): """ Test issue comment create/read/update/delete.""" self._create_issue_comment() self._get_issue_comment() self._update_issue_comment() self._delete_issue_comment()