22from packaging import version
33
44from posit import connect
5- from posit .connect .content import ContentItem , ContentItemRepository
5+ from posit .connect .content import ContentItemRepository
66
77from . import CONNECT_VERSION
88
@@ -11,18 +11,17 @@ class TestContentItemRepository:
1111 @classmethod
1212 def setup_class (cls ):
1313 cls .client = connect .Client ()
14+ cls .content = cls .client .content .create (name = "example" )
1415
1516 @classmethod
1617 def teardown_class (cls ):
18+ cls .content .delete ()
1719 assert cls .client .content .count () == 0
1820
1921 @property
2022 def content_name (self ):
2123 return "example"
2224
23- def create_content (self ) -> ContentItem :
24- return self .client .content .create (name = self .content_name )
25-
2625 @property
2726 def repo_repository (self ):
2827 return "https://github.com/posit-dev/posit-sdk-py"
@@ -55,7 +54,7 @@ def default_repository(self):
5554 reason = "Repository routes not implemented" ,
5655 )
5756 def test_create_get_update_delete (self ):
58- content = self .create_content ()
57+ content = self .content
5958
6059 # None by default
6160 assert content .repository is None
@@ -79,16 +78,14 @@ def assert_repo(r: ContentItemRepository):
7978
8079 # Update
8180 ex_branch = "main"
82- updated_repo = content_repo .update (branch = ex_branch )
83- assert updated_repo ["branch" ] == ex_branch
84-
85- assert updated_repo ["repository" ] == self .repo_repository
86- assert updated_repo ["directory" ] == self .repo_directory
87- assert updated_repo ["polling" ] is self .repo_polling
81+ content_repo .update (branch = ex_branch )
82+ assert content_repo ["branch" ] == ex_branch
83+ assert content_repo ["repository" ] == self .repo_repository
84+ assert content_repo ["directory" ] == self .repo_directory
85+ assert content_repo ["polling" ] is self .repo_polling
8886
8987 # Delete
90- content .repository .delete ()
88+ repository = content .repository
89+ assert repository is not None
90+ repository .destroy ()
9191 assert content .repository is None
92-
93- # Cleanup
94- content .delete ()
0 commit comments