Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can only search and lookup verified records #954

Merged
merged 1 commit into from
Dec 8, 2022
Merged

Conversation

bbengfort
Copy link
Collaborator

@bbengfort bbengfort commented Dec 8, 2022

Scope of changes

This PR adapts the GDS Search and Lookup RPCs to only returned VERIFIED records. The VerificationStatus RPC still returns any state, but you must have the ID or common name for this lookup so it is safer than Search and Lookup.

Type of change

  • bug fix
  • new feature
  • documentation
  • other (describe)

Acceptance criteria

The change is pretty simple, just a couple of lines of code in the Search and Lookup RPCs. The tests had to be radically altered however. I used a subtest method to isolate our different tests. Are the tests we have sufficient?

Author checklist

  • I have manually tested the change and/or added automation in the form of unit tests or integration tests
  • I have updated the dependencies list
  • I have recompiled and included new protocol buffers to reflect changes I made
  • I have added new test fixtures as needed to support added tests
  • Check this box if a reviewer can merge this pull request after approval (leave it unchecked if you want to do it yourself)
  • I have moved the associated Shortcut story to "Ready for Review"

Reviewer(s) checklist

  • Any new user-facing content that has been added for this PR has been QA'ed to ensure correct grammar, spelling, and understandability.
  • I understand how this will affect Search and Lookup on the GDS
  • The Lookup tests are sufficient and make sense (or if not, I've created stories for new tests)
  • The Search tests are sufficient and make sense (or if not, I've created stories for new tests)

Copy link
Collaborator

@pdeziel pdeziel left a comment

Choose a reason for hiding this comment

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

This looks good to me, I think the test coverage is sufficient and they were pretty easy to interpret - it made me think if there are other opportunities in the rest of the codebase where we can employ the subtest technique, maybe on some of the other "mega" endpoint tests?

}
_, err := client.Lookup(ctx, request)
require.EqualError(err, "rpc error: code = NotFound desc = could not find VASP by ID")
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the isolation of the subtests; it makes it way easier to read!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that the other mega endpoint tests could use a test breakdown like this - it makes it far easier to debug the tests too since each test is run independently.

require.NoError(err)
require.Empty(reply.Error)
require.Len(reply.Results, 0)
require.Equal(hotelVASP.VerificationStatus, pb.VerificationState_VERIFIED, "expected fixture to be in verified state")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good sanity checks.

require.Len(reply.Results, 1)
require.Equal(novemberVASP.Id, reply.Results[0].Id)

// Prefix search must have at least three characters
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this behavior documented on the Search endpoint?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good question -- the documentation doesn't mention it. Might be something to comment on.

@bbengfort bbengfort merged commit 652f5d8 into main Dec 8, 2022
@bbengfort bbengfort deleted the sc-10968/no-rejected branch December 8, 2022 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants