Skip to content

Commit 325ec54

Browse files
committed
[domain] minor fixes
1 parent 747f54e commit 325ec54

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

android_sms_gateway/domain.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class Message:
2323
data_message (Optional[DataMessage]): Data message.
2424
priority (Optional[MessagePriority]): Priority.
2525
sim_number (Optional[int]): SIM card number (1-3), if not set - default SIM will be used.
26-
with_delivery_report (Optional[bool]): With delivery report.
27-
is_encrypted (Optional[bool]): Is encrypted.
26+
with_delivery_report (bool): With delivery report.
27+
is_encrypted (bool): Is encrypted.
2828
ttl (Optional[int]): Time to live in seconds (conflicts with `validUntil`).
29-
valid_until (Optional[str]): Valid until (conflicts with `ttl`).
29+
valid_until (Optional[datetime.datetime]): Valid until (conflicts with `ttl`).
3030
id (Optional[str]): ID (if not set - will be generated).
3131
device_id (Optional[str]): Optional device ID for explicit selection.
3232
"""
@@ -46,6 +46,10 @@ class Message:
4646
id: t.Optional[str] = None
4747
device_id: t.Optional[str] = None
4848

49+
def __post_init__(self):
50+
if self.ttl is not None and self.valid_until is not None:
51+
raise ValueError("ttl and valid_until are mutually exclusive")
52+
4953
@property
5054
def content(self) -> str:
5155
if self.text_message:

tests/test_client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ def client():
2525
2626
:yields: An instance of `APIClient`.
2727
"""
28-
with (
29-
RequestsHttpClient() as h,
30-
APIClient(
28+
with RequestsHttpClient() as h, APIClient(
3129
os.environ.get("API_LOGIN") or "test",
3230
os.environ.get("API_PASSWORD") or "test",
3331
base_url=os.environ.get("API_BASE_URL") or DEFAULT_URL,
3432
http=h,
35-
) as c,
36-
):
33+
) as c:
3734
yield c
3835

3936

0 commit comments

Comments
 (0)