← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1406640] [NEW] Refactor role assignment assertions and creation of expected entities

 

Public bug reported:

On test_v3_assignment, the method assertValidRoleAssignment(..) [1] can be refactored in order to do a clearer comparison between the provided 'entity' and expected 'ref'.
In addition, assignment link comparison could allow regular expressions, enabling tests to verify the right link in the cases where the whole assignment information is not known. For example, if I call /v3/role_assignments?user_id=ni298n90, we could provide a 'ref' containing:

{
    'user': {'id': 'ni298n90'},
    'links': {'assignment': '.+/(domains|users)/.+/users/ni298n90/roles/.+'}
}

to the assertRoleAssignmentInListResponse(..) method.

To create entities with regular expressions inside the assignment link,
the creation of expected role assignments also needs to be changed on
test_v3_assignment [2].

[1] https://github.com/openstack/keystone/blob/master/keystone/tests/test_v3.py#L1034-L1074
[2] https://github.com/openstack/keystone/blob/master/keystone/tests/test_v3_assignment.py#L26-L71

** Affects: keystone
     Importance: Undecided
     Assignee: Samuel de Medeiros Queiroz (samuel-z)
         Status: New

** Changed in: keystone
     Assignee: (unassigned) => Samuel de Medeiros Queiroz (samuel-z)

** Summary changed:

- Refactori role assignment assertions and creation of expected entities
+ Refactor role assignment assertions and creation of expected entities

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1406640

Title:
  Refactor role assignment assertions and creation of expected entities

Status in OpenStack Identity (Keystone):
  New

Bug description:
  On test_v3_assignment, the method assertValidRoleAssignment(..) [1] can be refactored in order to do a clearer comparison between the provided 'entity' and expected 'ref'.
  In addition, assignment link comparison could allow regular expressions, enabling tests to verify the right link in the cases where the whole assignment information is not known. For example, if I call /v3/role_assignments?user_id=ni298n90, we could provide a 'ref' containing:

  {
      'user': {'id': 'ni298n90'},
      'links': {'assignment': '.+/(domains|users)/.+/users/ni298n90/roles/.+'}
  }

  to the assertRoleAssignmentInListResponse(..) method.

  To create entities with regular expressions inside the assignment
  link, the creation of expected role assignments also needs to be
  changed on test_v3_assignment [2].

  [1] https://github.com/openstack/keystone/blob/master/keystone/tests/test_v3.py#L1034-L1074
  [2] https://github.com/openstack/keystone/blob/master/keystone/tests/test_v3_assignment.py#L26-L71

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1406640/+subscriptions


Follow ups

References