-
Notifications
You must be signed in to change notification settings - Fork 4
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: get content for user #226
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from posit import connect | ||
|
||
|
||
class TestAttributeContent: | ||
"""Checks behavior of the content attribute.""" | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
cls.client = connect.Client() | ||
cls.user = cls.client.me | ||
cls.user.content.create( | ||
name="Sample", | ||
description="Simple sample content for testing", | ||
access_type="acl", | ||
) | ||
|
||
@classmethod | ||
def teardown_class(cls): | ||
assert cls.user.content.find_one().delete() is None | ||
assert cls.user.content.count() == 0 | ||
|
||
def test_count(self): | ||
assert self.user.content.count() == 1 | ||
|
||
def test_find(self): | ||
assert self.user.content.find() | ||
|
||
def test_find_one(self): | ||
assert self.user.content.find_one() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/posit/connect/__api__/v1/content?owner_guid=20a79ce3-6e87-4522-9faf-be24228800a4.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[ | ||
{ | ||
"guid": "93a3cd6d-5a1b-236c-9808-6045f2a73fb5", | ||
"name": "My-Streamlit-app", | ||
"title": "My Streamlit app", | ||
"description": "", | ||
"access_type": "logged_in", | ||
"connection_timeout": null, | ||
"read_timeout": null, | ||
"init_timeout": null, | ||
"idle_timeout": null, | ||
"max_processes": null, | ||
"min_processes": null, | ||
"max_conns_per_process": null, | ||
"load_factor": null, | ||
"memory_request": null, | ||
"memory_limit": null, | ||
"cpu_request": null, | ||
"cpu_limit": null, | ||
"amd_gpu_limit": null, | ||
"nvidia_gpu_limit": null, | ||
"service_account_name": null, | ||
"default_image_name": null, | ||
"created_time": "2023-02-28T14:00:17Z", | ||
"last_deployed_time": "2023-03-01T14:12:21Z", | ||
"bundle_id": "217640", | ||
"app_mode": "python-streamlit", | ||
"content_category": "", | ||
"parameterized": false, | ||
"cluster_name": "Local", | ||
"image_name": null, | ||
"r_version": null, | ||
"py_version": "3.9.17", | ||
"quarto_version": null, | ||
"r_environment_management": null, | ||
"default_r_environment_management": null, | ||
"py_environment_management": true, | ||
"default_py_environment_management": null, | ||
"run_as": null, | ||
"run_as_current_user": false, | ||
"owner_guid": "20a79ce3-6e87-4522-9faf-be24228800a4", | ||
"content_url": "https://connect.example/content/93a3cd6d-5a1b-236c-9808-6045f2a73fb5/", | ||
"dashboard_url": "https://connect.example/connect/#/apps/93a3cd6d-5a1b-236c-9808-6045f2a73fb5", | ||
"app_role": "viewer", | ||
"id": "8462", | ||
"owner": { | ||
"guid": "20a79ce3-6e87-4522-9faf-be24228800a4", | ||
"username": "carlos12", | ||
"first_name": "Carlos", | ||
"last_name": "User" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm new to the architecture of this package — for my own learning, what does this do?
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.
cls.item
is the content item created in thesetup_class
method. L16 performs a delete action, and L17 asserts that the total number of content items on the server is 0. The user used for testing has administrator privileges.The general idea here is to try and ensure a "clean" server state between test classes. That way, other test classes would not need to be aware of each other. I'm not sure this is viable in the long term, but it's okay for now.