Skip to content

Commit 0ec6061

Browse files
committed
feat: surface STATUS_PENDING and STATUS_PROCESSING on Export
Export only had STATUS_COMPLETED even though the status property documents three valid values. Add is_pending/is_processing/is_completed predicate properties so callers can check all three states without string literals.
1 parent 3fc8eb3 commit 0ec6061

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

src/didww/resources/export.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ class Export(DidwwApiModel):
1717
class Meta:
1818
type = "exports"
1919

20+
@property
21+
def is_pending(self):
22+
return self.status == ExportStatus.PENDING
23+
24+
@property
25+
def is_processing(self):
26+
return self.status == ExportStatus.PROCESSING
27+
28+
@property
29+
def is_completed(self):
30+
return self.status == ExportStatus.COMPLETED
31+
2032

2133
class ExportRepository(Repository):
2234
_resource_class = Export

tests/resources/test_export.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@
55
from didww.resources.export import Export
66

77

8+
class TestExportStatusHelpers:
9+
def test_is_pending(self):
10+
export = Export()
11+
export.status = ExportStatus.PENDING
12+
assert export.is_pending is True
13+
assert export.is_processing is False
14+
assert export.is_completed is False
15+
16+
def test_is_processing(self):
17+
export = Export()
18+
export.status = ExportStatus.PROCESSING
19+
assert export.is_processing is True
20+
assert export.is_pending is False
21+
assert export.is_completed is False
22+
23+
def test_is_completed(self):
24+
export = Export()
25+
export.status = ExportStatus.COMPLETED
26+
assert export.is_completed is True
27+
assert export.is_pending is False
28+
assert export.is_processing is False
29+
30+
831
class TestExport:
932
@my_vcr.use_cassette("exports/list.yaml")
1033
def test_list_exports(self, client):

0 commit comments

Comments
 (0)