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: initial support for getting content #53

Merged
merged 2 commits into from
Feb 27, 2024
Merged

feat: initial support for getting content #53

merged 2 commits into from
Feb 27, 2024

Conversation

nealrichardson
Copy link
Collaborator

I was curious to see how smooth it would be to add a new collection, following the pattern of Users and using responses for mocking. It was pretty smooth--this took me maybe 45 minutes, about half of that just contemplating the API and how it's different from v1/users, how it has additional query params we'll want to expose, etc.

For the record, my workflow was:

  • Create empty files: content.py and content_test.py
  • Use client.get("v1/content") to retrieve responses from a real Connect, try to cherry-pick a few items from that that had some variation to use as test fixtures
  • Sanitize those: manipulate GUIDs and other ids, replace owner_guids with ids of the users from users_test, alter names
  • Set up the test around that, using responses.get with that, then add test of client.content.find(), which fails of course because client has no attribute content yet
  • Add the property to Client, then copy the contents of users.py to content.py and adapt it. This was mostly replacing class names and stripping out pagination, since v1/content is not paginated 🤯
  • Fill in the rest of the tests

Copy link

github-actions bot commented Feb 24, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
470 470 100% 80% 🟢

New Files

File Coverage Status
src/posit/connect/content.py 100% 🟢
src/posit/connect/content_test.py 100% 🟢
TOTAL 100% 🟢

Modified Files

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

updated for commit: 38921e2 by action🐍

@nealrichardson
Copy link
Collaborator Author

I'm going to merge this so that I can help stub out something for Brian's new search endpoint. Happy to revisit any of the decisions here whenever you get a chance to review, or in future PRs.

@nealrichardson nealrichardson merged commit 4e929e4 into main Feb 27, 2024
7 checks passed
@nealrichardson nealrichardson deleted the content branch February 27, 2024 17:25
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.

1 participant