Skip to content

Commit

Permalink
Refactor NameID format related tests
Browse files Browse the repository at this point in the history
**Why**:
1. The tests are hard to understand and do not clearly show the
   different contexts
2. The tests assert on a side effect (the analytics event posted) rather
   than the actual desired behavior (the return values)
3. The tests are actually misleading - they conflate "unspecified" and
   unsupported

**How**:
- Refactor tests with clear contexts and shared examples
- Assert on actual return value and not on a side effect
- Clean up test case descriptions
- Assert that the correct attributes are logged in the analytics event

changelog: Internal, Automated Testing, Refactor NameID format related tests
  • Loading branch information
vrajmohan committed Jun 4, 2024
1 parent cc149aa commit e0d4a58
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 229 deletions.
1 change: 1 addition & 0 deletions lib/saml_idp_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module Constants

NAME_ID_FORMAT_PERSISTENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
NAME_ID_FORMAT_EMAIL = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
NAME_ID_FORMAT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
VALID_NAME_ID_FORMATS = [NAME_ID_FORMAT_PERSISTENT, NAME_ID_FORMAT_EMAIL].freeze

REQUESTED_ATTRIBUTES_CLASSREF = 'http://idmanagement.gov/ns/requested_attributes?ReqAttr='
Expand Down
Loading

0 comments on commit e0d4a58

Please sign in to comment.