-
Notifications
You must be signed in to change notification settings - Fork 26
Allow exact group matches #261
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
Conversation
tests/testthat/test-remote.R
Outdated
test_that("groups_create_remote creates multiples if multiple are found", { | ||
expect_error( | ||
groups_create_remote(con, "Art"), | ||
"The expected group\\(s\\) were not found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how this matches the test description
Hi, |
Co-authored-by: Neal Richardson <[email protected]>
# Conflicts: # tests/testthat/2024.08.0/__api__/v1/groups-2c8d16-PUT.json # tests/testthat/2024.08.0/__api__/v1/groups-8a8b3e-PUT.json # tests/testthat/2024.08.0/__api__/v1/groups-8e9a47.json # tests/testthat/2024.08.0/__api__/v1/groups-c01bad.json # tests/testthat/2024.08.0/__api__/v1/groups/remote-519747.json # tests/testthat/2024.08.0/__api__/v1/groups/remote-d27795.json
tests/testthat/test-remote.R
Outdated
test_that("groups_create_remote works if match already exists", { | ||
expect_message( | ||
groups_create_remote(con, "Everyone"), | ||
"Creating remote group" | ||
) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to test the check == FALSE
behavior?
tests/testthat/test-remote.R
Outdated
test_that("groups_create_remote creates match if one is found", { | ||
skip("not implemented") | ||
}) | ||
test_that("groups_create_remote creates multiples if multiple are found", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test wording seems to suggest that it's intended to test the behavior when expect > 1
. But there's also the skeleton of a test for an error if expect > 1
.
I made the following changes, and could use feedback on a few things: Testing. Some tests were implemented using the Return type. The functions previously returned a single user or group, which (1) was not guaranteed to even be the created group (since search happens by prefix there's no guarantee that the returned group was gonna be the one created) and (2) was nonsensical in the case of creating multiple groups in a single request. I changed this to return the aggregated output of the group/user creation API calls. However, because these could potentially be multiple calls, this is currently a list of lists. This is also technically a breaking change. 🤔 Three possible solutions I can think of:
[edit] @jonkeane I can't flag you for review on your own PR apparently, but comments would still be appreciated. :) |
Co-authored-by: Barret Schloerke <[email protected]>
Co-authored-by: Barret Schloerke <[email protected]>
@schloerke Thanks for your suggestions! Do you have any thoughts on my brain-dump in this comment? |
Reverted the return value after investigating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally re-requested review from myself; getting it off my list.
Adds an
exact
parameter togroups_create_remote
to allow creating a specific group even if there are multiple matches. This follows a similar change in #157This as well as the matching
users_create_remote
could use some refactoring, though I'm not sure it's worth it in this PR.Resolves #216