Skip to content

Commit

Permalink
Add tests for component contact delete with multi matches.
Browse files Browse the repository at this point in the history
  • Loading branch information
xychu committed Nov 12, 2015
1 parent eaf9f67 commit 5e296c3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Multi matches, please delete via ID or provide more restrictions.
ID Component Role Email Name
1 Test Global Component pm test_contact@example.com Test Contact
1 Test Global Component pm test_contact@example.com Test Contact
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Multi matches, please delete via ID or provide more restrictions.
ID Component Role Email Name
1 test-release/Test Release Component pm test_contact@example.com Test Contact
1 test-release/Test Release Component pm test_contact@example.com Test Contact
16 changes: 16 additions & 0 deletions pdc_client/tests/contact/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def test_delete_matched(self, api):
'role': 'pm'})],
'global-component-contacts/1': [('DELETE', {})]})

def test_delete_multi_matches(self, api):
api.add_endpoint('global-component-contacts', 'GET', [self.detail] * 2)
with self.expect_output('global_component_contact/multi_matches.txt'):
self.runner.run(['global-component-contact', 'delete-match', '--role', 'pm'])
self.assertDictEqual(api.calls,
{'global-component-contacts': [('GET', {'page': 1,
'role': 'pm'})]})

def test_create(self, api):
api.add_endpoint('global-component-contacts', 'POST', self.detail)
self._setup_detail(api)
Expand Down Expand Up @@ -174,6 +182,14 @@ def test_delete_matched(self, api):
'role': 'pm'})],
'release-component-contacts/1': [('DELETE', {})]})

def test_delete_multi_matches(self, api):
api.add_endpoint('release-component-contacts', 'GET', [self.detail] * 2)
with self.expect_output('release_component_contact/multi_matches.txt'):
self.runner.run(['release-component-contact', 'delete-match', '--role', 'pm'])
self.assertDictEqual(api.calls,
{'release-component-contacts': [('GET', {'page': 1,
'role': 'pm'})]})

def test_create(self, api):
api.add_endpoint('release-component-contacts', 'POST', self.detail)
self._setup_detail(api)
Expand Down

0 comments on commit 5e296c3

Please sign in to comment.