Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcaron committed Sep 24, 2018
1 parent 44c311c commit ff4121c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,30 @@ def test_GetCurrentUser(self):
else:
utils.check_val_equal(json_body['user_name'], self.usr)

@pytest.mark.groups
@unittest.skipUnless(runner.MAGPIE_TEST_GROUPS, reason=runner.MAGPIE_TEST_DISABLED_MESSAGE('groups'))
def test_PostUserGroup_assign(self):
route = '/users/{usr}/groups'.format(usr=get_constant('MAGPIE_ADMIN_USER'))
data = {'group_name': get_constant('MAGPIE_ANONYMOUS_GROUP')}
resp = utils.test_request(self.url, 'POST', route, headers=self.json_headers, cookies=self.cookies, data=data)
utils.check_response_basic_info(resp, 201)

@pytest.mark.groups
@unittest.skipUnless(runner.MAGPIE_TEST_GROUPS, reason=runner.MAGPIE_TEST_DISABLED_MESSAGE('groups'))
def test_PostUserGroup_not_found(self):
route = '/users/{usr}/groups'.format(usr=get_constant('MAGPIE_ADMIN_USER'))
data = {'group_name': 'not_found'}
resp = utils.test_request(self.url, 'POST', route, headers=self.json_headers, cookies=self.cookies, data=data)
utils.check_response_basic_info(resp, 404)

@pytest.mark.groups
@unittest.skipUnless(runner.MAGPIE_TEST_GROUPS, reason=runner.MAGPIE_TEST_DISABLED_MESSAGE('groups'))
def test_PostUserGroup_conflict(self):
route = '/users/{usr}/groups'.format(usr=get_constant('MAGPIE_ADMIN_USER'))
data = {'group_name': get_constant('MAGPIE_ADMIN_GROUP')}
resp = utils.test_request(self.url, 'POST', route, headers=self.json_headers, cookies=self.cookies, data=data)
utils.check_response_basic_info(resp, 409)

@pytest.mark.groups
@unittest.skipUnless(runner.MAGPIE_TEST_GROUPS, reason=runner.MAGPIE_TEST_DISABLED_MESSAGE('groups'))
def test_GetGroupUsers(self):
Expand Down

0 comments on commit ff4121c

Please sign in to comment.