Skip to content

Commit 61fa7c8

Browse files
committed
Change to freezegun
1 parent 412b3e0 commit 61fa7c8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/platform/test_service_cart_discounts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime
22

33
import pytest
4+
from freezegun import freeze_time
45
from requests.exceptions import HTTPError
56

67
from commercetools.platform import models
@@ -94,7 +95,7 @@ def test_cart_discount_update(old_client):
9495
assert cart_discount.is_active is False
9596

9697

97-
@pytest.mark.freeze_time("2021-03-01 12:34:56")
98+
@freeze_time("2021-03-01 12:34:56")
9899
def test_cart_discount_set_valid_from(old_client):
99100
cart_discount = old_client.cart_discounts.create(
100101
models.CartDiscountDraft(
@@ -118,7 +119,7 @@ def test_cart_discount_set_valid_from(old_client):
118119
assert cart_discount.valid_from == datetime.now()
119120

120121

121-
@pytest.mark.freeze_time("2021-03-01 12:34:56")
122+
@freeze_time("2021-03-01 12:34:56")
122123
def test_cart_discount_set_valid_until(old_client):
123124
cart_discount = old_client.cart_discounts.create(
124125
models.CartDiscountDraft(

tests/platform/test_service_discount_codes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime
22

33
import pytest
4+
from freezegun import freeze_time
45
from requests.exceptions import HTTPError
56

67
from commercetools.platform import models
@@ -73,7 +74,7 @@ def test_discount_code_update(old_client):
7374
assert discount_code.is_active is False
7475

7576

76-
@pytest.mark.freeze_time("2021-03-01 12:34:56")
77+
@freeze_time("2021-03-01 12:34:56")
7778
def test_discount_code_set_valid_from(old_client):
7879
discount_code = old_client.discount_codes.create(
7980
models.DiscountCodeDraft(
@@ -95,7 +96,7 @@ def test_discount_code_set_valid_from(old_client):
9596
assert discount_code.valid_from == datetime.now()
9697

9798

98-
@pytest.mark.freeze_time("2021-03-01 12:34:56")
99+
@freeze_time("2021-03-01 12:34:56")
99100
def test_discount_code_set_valid_until(old_client):
100101
discount_code = old_client.discount_codes.create(
101102
models.DiscountCodeDraft(

0 commit comments

Comments
 (0)