-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Lightmatter/feature/cdt-export
Add CDT record export
- Loading branch information
Showing
6 changed files
with
100,292 additions
and
4 deletions.
There are no files selected for viewing
100,233 changes: 100,233 additions & 0 deletions
100,233
test/cassettes/test_cdt_records_export_read.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.vcr | ||
def test_cdt_records_export_read(client, vcr_cassette): | ||
export = client.CDTRecordsExport() | ||
|
||
exports = list(export.get(paginate=True, size=1000)) | ||
|
||
assert len(exports) > 1 | ||
assert len(vcr_cassette) == 6 |
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
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,23 @@ | ||
from __future__ import annotations | ||
|
||
from welkin.models.base import Collection, Resource | ||
from welkin.models.encounter import Encounters | ||
from welkin.pagination import CursorIterator | ||
|
||
|
||
class CDTRecordExport(Resource): | ||
subresources = (Encounters,) | ||
|
||
def __str__(self): | ||
try: | ||
return f"{self.firstName} {self.lastName}" | ||
except AttributeError: | ||
return self.username | ||
|
||
|
||
class CDTRecordsExport(Collection): | ||
resource = CDTRecordExport | ||
iterator = CursorIterator | ||
|
||
def get(self, *args, **kwargs): | ||
return super().get(f"{self._client.instance}/export/CDT_RECORD", *args, **kwargs) |
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