Skip to content

Exclude stale sessions in IAL2 usage query#11528

Merged
Sgtpluck merged 2 commits intomainfrom
dmm/fix-query
Nov 20, 2024
Merged

Exclude stale sessions in IAL2 usage query#11528
Sgtpluck merged 2 commits intomainfrom
dmm/fix-query

Conversation

@Sgtpluck
Copy link
Copy Markdown
Contributor

🎫 Ticket

Link to the relevant ticket:
Fix facial match usage query

🛠 Summary of changes

  • Excludes 'SAML Auth' and 'OpenID Connect: authorization request' from the IAL2 usage report
  • Adds tests to make sure the queries look okay as per feedback on last PR

Copy link
Copy Markdown
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

saml_signature_query
].each do |query|
expect(client).to have_received(:fetch).with(
query: report.send(query),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think it'd be reasonable to assume (and assert) these methods are part of the class's public API?

Suggested change
query: report.send(query),
query: report.public_send(query),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm happy to make this update, but am curious about what advantages you see for using public_send? just that it's implicitly asserting that the method is public? (which maybe it actually shouldn't be? but that's overthinking this report code at the moment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 67530e6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my thought process was:

  • "Are we calling internal methods in this spec in a way which pierces the abstraction?
  • "Oh, no we're not, because those methods are indeed public"
  • "So maybe we should add some guarantees that those are indeed public"
  • "public_send will loudly fail if they're not public, and would be easy to swap in"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Comment on lines +125 to +127
before do
allow(client).to receive(:fetch).and_call_original
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this do anything?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, it sets up the spy!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, I misread the setup below as expect(client).to receive, thinking that made this allow redundant.

@Sgtpluck Sgtpluck merged commit bf8e696 into main Nov 20, 2024
@Sgtpluck Sgtpluck deleted the dmm/fix-query branch November 20, 2024 14:04
@aduth aduth mentioned this pull request Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants