Fix pour les tests

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-09-01 15:56:48 +02:00
parent 38ac206c74
commit 1fc2beb609
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 11 additions and 11 deletions

View File

@ -26,12 +26,12 @@ class Result:
@dataclass
class Vaccination(Result):
vaccine: str # vp
medical_product: str # mp
manufacturer: str # ma
dose_number: int # dn
total_series_of_doses: int # sd
date_of_vaccination: str # dt
vaccine: Optional[str] = None # vp
medical_product: Optional[str] = None # mp
manufacturer: Optional[str] = None # ma
def check(self) -> bool:
# Toutes les doses ont bien été injectées
@ -68,13 +68,13 @@ class Test(Result):
POSITIVE = '260373001'
NEGATIVE = '260415000'
type_of_test: str # tt
test_name: str # nm
manufacturer: str # ma
date: str # sc
result_date: str # dr
result: TestResult # tr
center: str # tc
type_of_test: Optional[str] = None # tt
test_name: Optional[str] = None # nm
manufacturer: Optional[str] = None # ma
result_date: Optional[str] = None # dr
center: Optional[str] = None # tc
@staticmethod
def deserialize(payload) -> "Test":
@ -94,8 +94,8 @@ class Test(Result):
return Test(**{translation[k]: v for k, v in payload.items()})
def check(self) -> bool:
valid = self.result == TestResult.NEGATIVE
test_date = datetime.datetime.fromisoformat(self.result_date)
valid = self.result == Test.TestResult.NEGATIVE
test_date = datetime.datetime.fromisoformat(self.date)
tzinfo = test_date.tzinfo
delta = datetime.datetime.now(tzinfo) - test_date
valid = valid and delta.days < 3 # 72h de validité

View File

@ -1,6 +1,6 @@
[metadata]
name = pscheck
version = 1.1
version = 1.1.1
long_description = file: README.rst
long_description_content_type = text/markdown
description = Vérificateur de pass sanitaire