コード例 #1
0
ファイル: test_issues.py プロジェクト: BabisK/python-taiga
 def test_add_comment(self, mock_update):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1)
     issue.add_comment('hola')
     mock_update.assert_called_with(
         comment='hola'
     )
コード例 #2
0
ファイル: test_issues.py プロジェクト: mlq/python-taiga
 def test_add_comment(self, mock_update):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1)
     issue.add_comment('hola')
     mock_update.assert_called_with(
         comment='hola'
     )
コード例 #3
0
ファイル: test_issues.py プロジェクト: jespino/python-taiga
 def test_file_attach(self, mock_new_resource, mock_open):
     fd = open("tests/resources/tasks_list_success.json")
     mock_open.return_value = fd
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1, project=1)
     issue.attach("tests/resources/tasks_list_success.json")
     mock_new_resource.assert_called_with(files={"attached_file": fd}, payload={"project": 1, "object_id": 1})
コード例 #4
0
 def test_file_attach(self, mock_new_resource, mock_open):
     fd = open("tests/resources/tasks_list_success.json")
     mock_open.return_value = fd
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1, project=1)
     issue.attach("tests/resources/tasks_list_success.json")
     mock_new_resource.assert_called_with(files={"attached_file": fd}, payload={"project": 1, "object_id": 1})
コード例 #5
0
 def test_downvote(self, mock_requestmaker_post):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1)
     self.assertEqual(issue.downvote().id, 1)
     mock_requestmaker_post.assert_called_with('/{endpoint}/{id}/downvote',
                                               endpoint='issues',
                                               id=1)
コード例 #6
0
ファイル: test_issues.py プロジェクト: BabisK/python-taiga
 def test_downvote(self, mock_requestmaker_post):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1)
     self.assertEqual(issue.downvote().id, 1)
     mock_requestmaker_post.assert_called_with(
         '/{endpoint}/{id}/downvote',
         endpoint='issues', id=1
     )
コード例 #7
0
ファイル: test_issues.py プロジェクト: vanjos/python-taiga
 def test_open_file_attach(self, mock_new_resource):
     fd = open('tests/resources/tasks_list_success.json')
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1, project=1)
     issue.attach(fd)
     mock_new_resource.assert_called_with(
         files={'attached_file': fd},
         payload={'project': 1, 'object_id': 1}
     )
コード例 #8
0
 def test_get_issue_custom_attributes(self, mock_requestmaker_get):
     mock_requestmaker_get.return_value = MockResponse(200,
         create_mock_json('tests/resources/issue_customattr_success.json'))
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1, project=1)
     my_attributes = issue.get_attributes()
     self.assertTrue('attributes_values' in my_attributes)
     mock_requestmaker_get.assert_called_with(
         '/{endpoint}/custom-attributes-values/{id}',
         endpoint=Issue.endpoint, id=issue.id, cache=False
     )
コード例 #9
0
 def test_get_issue_custom_attributes(self, mock_requestmaker_get):
     mock_requestmaker_get.return_value = MockResponse(200,
         create_mock_json('tests/resources/issue_customattr_success.json'))
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1, project=1)
     my_attributes = issue.get_attributes()
     self.assertTrue('attributes_values' in my_attributes)
     mock_requestmaker_get.assert_called_with(
         '/{endpoint}/custom-attributes-values/{id}',
         endpoint=Issue.endpoint, id=issue.id,
     )
コード例 #10
0
ファイル: test_issues.py プロジェクト: mlq/python-taiga
 def test_list_attachments(self, mock_requestmaker_get):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     Issue(rm, id=1).list_attachments()
     mock_requestmaker_get.assert_called_with(
         'issues/attachments',
         query={"object_id": 1},
     )
コード例 #11
0
 def test_list_attachments(self, mock_requestmaker_get):
     mock_requestmaker_get.return_value = MockResponse(
         200, create_mock_json("tests/resources/issues_list_success.json")
     )
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     Issue(rm, id=1).list_attachments()
     mock_requestmaker_get.assert_called_with("issues/attachments", query={"object_id": 1}, paginate=True)
コード例 #12
0
 def test_edit_issue_custom_attribute(self, mock_requestmaker_patch, mock_requestmaker_get):
     mock_requestmaker_get.return_value = MockResponse(200,
         create_mock_json('tests/resources/issue_customattr_success.json'))
     mock_requestmaker_patch.return_value = MockResponse(200,
         create_mock_json('tests/resources/issue_customattr_success.json'))
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1, project=1)
     new_attribute = issue.set_attribute(1, 13)
     self.assertTrue('attributes_values' in new_attribute)
     mock_requestmaker_patch.assert_called_with(
         '/{endpoint}/custom-attributes-values/{id}',
         endpoint=Issue.endpoint, id=issue.id,
         payload={
             'attributes_values': {u'1': 13},
             'version': 1
         }
     )
コード例 #13
0
 def test_edit_issue_custom_attribute(self, mock_requestmaker_patch, mock_requestmaker_get):
     mock_requestmaker_get.return_value = MockResponse(
         200, create_mock_json("tests/resources/issue_customattr_success.json")
     )
     mock_requestmaker_patch.return_value = MockResponse(
         200, create_mock_json("tests/resources/issue_customattr_success.json")
     )
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1, project=1)
     new_attribute = issue.set_attribute(1, 13)
     self.assertTrue("attributes_values" in new_attribute)
     mock_requestmaker_patch.assert_called_with(
         "/{endpoint}/custom-attributes-values/{id}",
         endpoint=Issue.endpoint,
         id=issue.id,
         payload={"attributes_values": {"1": 13}, "version": 1},
     )
コード例 #14
0
 def test_edit_issue_custom_attribute(self, mock_requestmaker_patch, mock_requestmaker_get):
     mock_requestmaker_get.return_value = MockResponse(200,
         create_mock_json('tests/resources/issue_customattr_success.json'))
     mock_requestmaker_patch.return_value = MockResponse(200,
         create_mock_json('tests/resources/issue_customattr_success.json'))
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1, project=1)
     new_attribute = issue.set_attribute(1, 13)
     self.assertTrue('attributes_values' in new_attribute)
     mock_requestmaker_patch.assert_called_with(
         '/{endpoint}/custom-attributes-values/{id}',
         endpoint=Issue.endpoint, id=issue.id,
         payload={
             'attributes_values': {u'1': 13},
             'version': 1
         }
     )
コード例 #15
0
 def test_not_existing_file_attach(self):
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1, project=1)
     self.assertRaises(TaigaException, issue.attach, "not-existing-file")
コード例 #16
0
 def test_downvote(self, mock_requestmaker_post):
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1)
     self.assertEqual(issue.downvote().id, 1)
     mock_requestmaker_post.assert_called_with("/{endpoint}/{id}/downvote", endpoint="issues", id=1)
コード例 #17
0
ファイル: test_issues.py プロジェクト: vanjos/python-taiga
 def test_not_existing_file_attach(self):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     issue = Issue(rm, id=1, project=1)
     self.assertRaises(TaigaException, issue.attach, 'not-existing-file')
コード例 #18
0
 def test_not_valid_type_file_attach(self):
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1, project=1)
     self.assertRaises(TaigaException, issue.attach, 4)
コード例 #19
0
 def test_add_comment(self, mock_update):
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1)
     issue.add_comment("hola")
     mock_update.assert_called_with(comment="hola")
コード例 #20
0
ファイル: test_issues.py プロジェクト: jespino/python-taiga
 def test_downvote(self, mock_requestmaker_post):
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     issue = Issue(rm, id=1)
     self.assertEqual(issue.downvote().id, 1)
     mock_requestmaker_post.assert_called_with("/{endpoint}/{id}/downvote", endpoint="issues", id=1)