def setUp(self): self.ms = Members()
class TestMemberService(TestCase): def setUp(self): self.ms = Members() def test_LIST(self, request_method): request_method.return_value = mock_response_result() self.ms.list('acme').all() self.assertEqual(request_method.call_args[0], ('get', _('orgs/acme/members'))) def test_IS_MEMBER(self, request_method): request_method.return_value = mock_response() self.ms.is_member('acme', 'octocat') self.assertEqual(request_method.call_args[0], ('head', _('orgs/acme/members/octocat'))) def test_REMOVE_MEMBER(self, request_method): request_method.return_value = mock_response('delete') self.ms.remove_member('acme', 'octocat') self.assertEqual(request_method.call_args[0], ('delete', _('orgs/acme/members/octocat'))) def test_LIST_PUBLIC(self, request_method): request_method.return_value = mock_response_result() self.ms.list_public('acme').all() self.assertEqual(request_method.call_args[0], ('get', _('orgs/acme/public_members'))) def test_IS_PUBLIC_MEMBER(self, request_method): request_method.return_value = mock_response() self.ms.is_public_member('acme', 'octocat') self.assertEqual(request_method.call_args[0], ('head', _('orgs/acme/public_members/octocat'))) def test_PUBLICIZE_MEMBERSHIP(self, request_method): request_method.return_value = mock_response() self.ms.publicize_membership('acme', 'octocat') self.assertEqual(request_method.call_args[0], ('put', _('orgs/acme/public_members/octocat'))) def test_CONCEAL_MEMBERSHIP(self, request_method): request_method.return_value = mock_response('delete') self.ms.conceal_membership('acme', 'octocat') self.assertEqual(request_method.call_args[0], ('delete', _('orgs/acme/public_members/octocat')))