Skip to content

Commit

Permalink
tests: make it run again
Browse files Browse the repository at this point in the history
* not sure why it ever worked, could be that some dependency changed due
  to the utcnow() vs now(timezone.utc) change in some packages
  • Loading branch information
utnapischtim committed Sep 24, 2024
1 parent 2711904 commit 411f9cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
17 changes: 10 additions & 7 deletions tests/resources/test_resources.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 CERN.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio-Banners is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""Banner resource tests."""
from datetime import date, datetime
from datetime import date, datetime, timedelta

import pytest
from invenio_records_resources.services.errors import PermissionDeniedError
Expand All @@ -19,24 +20,26 @@
"url_path": "/banner1",
"category": "info",
"active": True,
"start_datetime": date(2022, 7, 20),
"end_datetime": date(2023, 1, 29),
"start_datetime": date(2022, 7, 20).strftime("%Y-%m-%d %H:%M:%S"),
"end_datetime": (datetime.now() + timedelta(days=365)).strftime(
"%Y-%m-%d %H:%M:%S"
),
},
"banner2": {
"message": "banner2",
"url_path": "/banner2",
"category": "other",
"active": False,
"start_datetime": date(2022, 12, 15),
"end_datetime": date(2023, 1, 5),
"start_datetime": date(2022, 12, 15).strftime("%Y-%m-%d %H:%M:%S"),
"end_datetime": date(2023, 1, 5).strftime("%Y-%m-%d %H:%M:%S"),
},
"banner3": {
"message": "banner3",
"url_path": "/banner3",
"category": "warning",
"active": True,
"start_datetime": date(2023, 1, 20),
"end_datetime": date(2023, 2, 25),
"start_datetime": date(2023, 1, 20).strftime("%Y-%m-%d %H:%M:%S"),
"end_datetime": date(2023, 2, 25).strftime("%Y-%m-%d %H:%M:%S"),
},
}

Expand Down
6 changes: 5 additions & 1 deletion tests/services/test_services.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 CERN.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio-Banners is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -21,7 +22,10 @@
"message": "active",
"url_path": "/active",
"category": "info",
"end_datetime": datetime.utcnow() + timedelta(days=1),
"start_datetime": datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S"),
"end_datetime": (datetime.utcnow() + timedelta(days=1)).strftime(
"%Y-%m-%d %H:%M:%S"
),
"active": True,
},
"inactive": {
Expand Down

0 comments on commit 411f9cb

Please sign in to comment.