-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
101 additions
and
35 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from posit import connect | ||
|
||
|
||
class TestVanities: | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
cls.client = connect.Client() | ||
|
||
@classmethod | ||
def teardown_class(cls): | ||
assert cls.client.content.count() == 0 | ||
|
||
def test_all(self): | ||
content = self.client.content.create(name="example") | ||
|
||
# None by default | ||
vanities = self.client.vanities.all() | ||
assert len(vanities) == 0 | ||
|
||
# Set | ||
content.vanity = "example" | ||
|
||
# Get | ||
vanities = self.client.vanities.all() | ||
assert len(vanities) == 1 | ||
|
||
# Cleanup | ||
content.delete() | ||
|
||
vanities = self.client.vanities.all() | ||
assert len(vanities) == 0 | ||
|
||
def test_property(self): | ||
content = self.client.content.create(name="example") | ||
|
||
# None by default | ||
assert content.vanity is None | ||
|
||
# Set | ||
content.vanity = "example" | ||
|
||
# Get | ||
vanity = content.vanity | ||
assert vanity | ||
assert vanity["path"] == "/example/" | ||
|
||
# Delete | ||
del content.vanity | ||
assert content.vanity is None | ||
|
||
# Cleanup | ||
content.delete() | ||
|
||
|
||
def test_destroy(self): | ||
content = self.client.content.create(name="example") | ||
|
||
# None by default | ||
assert content.vanity is None | ||
|
||
# Set | ||
content.vanity = "example" | ||
|
||
# Get | ||
vanity = content.vanity | ||
assert vanity | ||
assert vanity["path"] == "/example/" | ||
|
||
# Delete | ||
vanity.destroy() | ||
assert content.vanity is None | ||
|
||
# Cleanup | ||
content.delete() |
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