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
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ dependencies = [
[project.optional-dependencies]
zones = [
"mapchete",
"shapely",
"tilematrix"
]
test = [
"mapchete_hub>=2023.12.0",
Expand Down
5 changes: 5 additions & 0 deletions src/mapchete_hub_cli/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def __repr__(self): # pragma: no cover
def __hash__(self):
return hash(self.job_id)

def __eq__(self, other):
if not isinstance(other, Job): # pragma: no cover
return False
return self.job_id == other.job_id

def _update(self, job: Job):
self.status = job.status
self._dict = job._dict
Expand Down
22 changes: 12 additions & 10 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,15 @@ def test_list_jobs_from_date(mhub_client, example_config_json):
)
).job_id

now = datetime.datetime.utcfromtimestamp(time.time()).strftime("%Y-%m-%dT%H:%M:%SZ")
now = datetime.datetime.fromtimestamp(time.time(), datetime.timezone.utc).strftime(
"%Y-%m-%dT%H:%M:%SZ"
)
jobs = mhub_client.jobs(from_date=now)
assert job_id in jobs

future = datetime.datetime.utcfromtimestamp(time.time() + 60).strftime(
"%Y-%m-%dT%H:%M:%SZ"
)
future = datetime.datetime.fromtimestamp(
time.time() + 60, datetime.timezone.utc
).strftime("%Y-%m-%dT%H:%M:%SZ")
jobs = mhub_client.jobs(from_date=future)
assert job_id not in jobs

Expand All @@ -215,15 +217,15 @@ def test_list_jobs_to_date(mhub_client, example_config_json):
)
).job_id

now = datetime.datetime.utcfromtimestamp(time.time() + 60).strftime(
"%Y-%m-%dT%H:%M:%SZ"
)
now = datetime.datetime.fromtimestamp(
time.time() + 60, datetime.timezone.utc
).strftime("%Y-%m-%dT%H:%M:%SZ")
jobs = mhub_client.jobs(to_date=now)
assert job_id in jobs

past = datetime.datetime.utcfromtimestamp(time.time() - 60).strftime(
"%Y-%m-%dT%H:%M:%SZ"
)
past = datetime.datetime.fromtimestamp(
time.time() - 60, datetime.timezone.utc
).strftime("%Y-%m-%dT%H:%M:%SZ")
jobs = mhub_client.jobs(to_date=past)
assert job_id not in jobs

Expand Down