Skip to content

Instantly share code, notes, and snippets.

@lbragstad
Created September 10, 2014 20:18
Show Gist options
  • Save lbragstad/b9fb414ab1687f0d62af to your computer and use it in GitHub Desktop.
Save lbragstad/b9fb414ab1687f0d62af to your computer and use it in GitHub Desktop.
# FIXME(lbragstad): Move this test to tests/test_v3_assignment.py
def test_delete_user_before_role_assignment_succeeds(self):
"""Call ``DELETE`` on the user before the role assignment."""
# Assign the user a role on the project
collection_url = (
'/projects/%(project_id)s/users/%(user_id)s/roles' % {
'project_id': self.project_id,
'user_id': self.user_id})
member_url = ('%(collection_url)s/%(role_id)s' % {
'collection_url': collection_url,
'role_id': self.role_id})
self.put(member_url, expected_status=204)
# Delete the user
self.delete('/users/%(user_id)s' % {'user_id': self.user['id']},
expected_status=204)
# Check if the user has the specified role on the project
# FIXME(lbragstad): locally, this is raising a 401 Unauthorized
# because of https://github.com/openstack/keystone/blob/master/keystone/auth/plugins/password.py#L100
self.head(member_url, expected_status=404)
# Attempt revoking the role from the user
self.delete(member_url, expected_status=404)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment