Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions archivist/archivist.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,38 @@ def __init__(self, url, *, auth=None, cert=None, verify=True):

self._cert = cert

self.assets = _AssetsClient(self)
self.events = _EventsClient(self)
self.locations = _LocationsClient(self)
self.attachments = _AttachmentsClient(self)
self._assets = None
self._events = None
self._locations = None
self._attachments = None

@property
def assets(self):
"""docstring"""
if self._assets is None:
self._assets = _AssetsClient(self)
return self._assets

@property
def events(self):
"""docstring"""
if self._events is None:
self._events = _EventsClient(self)
return self._events

@property
def locations(self):
"""docstring"""
if self._locations is None:
self._locations = _LocationsClient(self)
return self._locations

@property
def attachments(self):
"""docstring"""
if self._attachments is None:
self._attachments = _AttachmentsClient(self)
return self._attachments

@property
def headers(self):
Expand Down
24 changes: 24 additions & 0 deletions unittests/testarchivist.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@ def test_archivist(self):
Test default archivist creation
"""
arch = Archivist("url", auth="authauthauth")
self.assertIsNotNone(
arch.assets,
msg="Incorrect assets",
)
self.assertIsNotNone(
arch.events,
msg="Incorrect events",
)
self.assertIsNotNone(
arch.locations,
msg="Incorrect locations",
)
self.assertIsNotNone(
arch.locations,
msg="Incorrect locations",
)
self.assertIsNotNone(
arch.attachments,
msg="Incorrect attachments",
)
self.assertIsNotNone(
arch.attachments,
msg="Incorrect attachments",
)
self.assertEqual(
arch.url,
"url",
Expand Down