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

feat: adds groups #227

Merged
merged 1 commit into from
Jun 25, 2024
Merged

feat: adds groups #227

merged 1 commit into from
Jun 25, 2024

Conversation

tdstein
Copy link
Collaborator

@tdstein tdstein commented Jun 24, 2024

Unit tests are sparse since we have integration tests now.

Copy link

github-actions bot commented Jun 24, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1086 1017 94% 0% 🟢

New Files

File Coverage Status
src/posit/connect/groups.py 48% 🟢
TOTAL 48% 🟢

Modified Files

File Coverage Status
src/posit/connect/client.py 99% 🟢
TOTAL 99% 🟢

updated for commit: 9b11d5c by action🐍

@tdstein tdstein force-pushed the tdstein/find-groups branch from d2c53a6 to 9b11d5c Compare June 25, 2024 13:16
Comment on lines +92 to +93
path = "v1/groups"
url = urls.append(self.config.url, path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason to have path as a separate variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

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

This is looking good, one minor comment. (Sorry I didn't use the actual review flow with that one, wasn't sure how long I would be able to pay attention to this and didn't want comments dangling)

Unit tests are sparse since we have integration tests now.

The test you have there is probably good enough, but IMHO and generally: leaning too heavily on integration tests will make development much harder. Having robust unit tests means it's quick + easy to get started and poke at it without relying on throwing it at CI and waiting for that to churn.

@tdstein
Copy link
Collaborator Author

tdstein commented Jun 25, 2024

The test you have there is probably good enough, but IMHO and generally: leaning too heavily on integration tests will make development much harder. Having robust unit tests means it's quick + easy to get started and poke at it without relying on throwing it at CI and waiting for that to churn.

💯 Completely agree. I'm hoping to get more unit tests in as I fill out the rest of the group's API.

@tdstein tdstein merged commit 6ce4066 into main Jun 25, 2024
29 checks passed
@tdstein tdstein deleted the tdstein/find-groups branch June 25, 2024 14:43
Copy link
Collaborator

@toph-allen toph-allen left a comment

Choose a reason for hiding this comment

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

Looks good. I haven't looked at the Python SDK code much yet, and it's nice & very concise. :)

Comment on lines +4 to +23
class TestGroups:
def setup_class(cls):
cls.client = connect.Client()
cls.item = cls.client.groups.create(name="Friends")

def teardown_class(cls):
cls.item.delete()
assert cls.client.groups.count() == 0

def test_count(self):
assert self.client.groups.count() == 1

def test_get(self):
assert self.client.groups.get(self.item.guid)

def test_find(self):
assert self.client.groups.find() == [self.item]

def test_find_one(self):
assert self.client.groups.find_one() == self.item
Copy link
Collaborator

Choose a reason for hiding this comment

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

So concise 😍

@@ -94,6 +95,17 @@ def oauth(self) -> OAuthIntegration:
"""
return OAuthIntegration(config=self.config, session=self.session)

@property
def groups(self) -> Groups:
"""The groups resource interface.
Copy link
Collaborator

Choose a reason for hiding this comment

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

My gut response is that I'd want to see more descriptive text here, if this is used as doc text in the CLI. I don't know if "groups resource interface" will be a particularly meaningful term for our users (it isn't for me).

I see that some of this (resource) is terminology used throughout the package, and maybe it'll make more sense to me as I get to know it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call out. The entire Client class could use some documentation love.

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