Skip to content

Commit db977d0

Browse files
committed
Change actions to use camelcase
1 parent d81659f commit db977d0

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

src/commercetools/testing/cart_discounts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ def set_valid_from(
7070
):
7171
# real API always increments version, so always apply new value.
7272
new = copy.deepcopy(obj)
73-
new["valid_from"] = action.valid_from.isoformat()
73+
new["validFrom"] = action.valid_from.isoformat()
7474
return new
7575

7676
def set_valid_until(
7777
self, obj, action: models.CartDiscountSetValidUntilAction
7878
):
7979
# real API always increments version, so always apply new value.
8080
new = copy.deepcopy(obj)
81-
new["valid_until"] = action.valid_until.isoformat()
81+
new["validUntil"] = action.valid_until.isoformat()
8282
return new
8383

8484
_actions = {

src/commercetools/testing/discount_codes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ def set_valid_from(
6464
):
6565
# real API always increments version, so always apply new value.
6666
new = copy.deepcopy(obj)
67-
new["valid_from"] = action.valid_from.isoformat()
67+
new["validFrom"] = action.valid_from.isoformat()
6868
return new
6969

7070
def set_valid_until(
7171
self, obj, action: models.DiscountCodeSetValidUntilAction
7272
):
7373
# real API always increments version, so always apply new value.
7474
new = copy.deepcopy(obj)
75-
new["valid_until"] = action.valid_until.isoformat()
75+
new["validUntil"] = action.valid_until.isoformat()
7676
return new
7777

7878
def change_cart_discounts(
7979
self, obj, action: models.DiscountCodeChangeCartDiscountsAction
8080
):
8181
# real API always increments version, so always apply new value.
8282
new = copy.deepcopy(obj)
83-
new["cart_discounts"] = [cart_discount.serialize() for cart_discount in action.cart_discounts]
83+
new["cartDiscounts"] = [cart_discount.serialize() for cart_discount in action.cart_discounts]
8484
return new
8585

8686
_actions = {

tests/platform/test_service_cart_discounts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_cart_discount_set_valid_from(old_client):
114114
actions=[models.CartDiscountSetValidFromAction(valid_from=datetime.now())],
115115
)
116116

117-
assert cart_discount.valid_from == datetime.now().isoformat()
117+
assert cart_discount.valid_from == datetime.now()
118118

119119

120120
@pytest.mark.freeze_time("2021-03-01 12:34:56")
@@ -137,4 +137,4 @@ def test_cart_discount_set_valid_until(old_client):
137137
actions=[models.CartDiscountSetValidUntilAction(valid_until=datetime.now())],
138138
)
139139

140-
assert cart_discount.valid_until == datetime.now().isoformat()
140+
assert cart_discount.valid_until == datetime.now()

tests/platform/test_service_discount_codes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_discount_code_update(old_client):
7373
assert discount_code.is_active is False
7474

7575

76-
@pytest.mark.freeze_time("2021-03-01")
76+
@pytest.mark.freeze_time("2021-03-01 12:34:56")
7777
def test_discount_code_set_valid_from(old_client):
7878
discount_code = old_client.discount_codes.create(
7979
models.DiscountCodeDraft(
@@ -95,7 +95,7 @@ def test_discount_code_set_valid_from(old_client):
9595
assert discount_code.valid_from == datetime.now()
9696

9797

98-
@pytest.mark.freeze_time("2021-03-01")
98+
@pytest.mark.freeze_time("2021-03-01 12:34:56")
9999
def test_discount_code_set_valid_until(old_client):
100100
discount_code = old_client.discount_codes.create(
101101
models.DiscountCodeDraft(
@@ -115,7 +115,7 @@ def test_discount_code_set_valid_until(old_client):
115115
)
116116

117117
assert discount_code.version == 2
118-
assert discount_code.valid_until == datetime.now().isoformat()
118+
assert discount_code.valid_until == datetime.now()
119119

120120

121121
def test_discount_code_change_cart_discounts(old_client):
@@ -150,4 +150,4 @@ def test_discount_code_change_cart_discounts(old_client):
150150
)
151151

152152
assert discount_code.version == 2
153-
assert discount_code.cart_discounts == cart_discount
153+
assert discount_code.cart_discounts == [models.CartDiscountReference(id=cart_discount.id)]

tests/test_pagination.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22

33
from commercetools import paginators
4-
from commercetools.contrib.pytest import ct_platform_client
54
from commercetools.platform import models
65
from commercetools.platform.client import Client
76
from commercetools.platform.client.by_project_key_request_builder import (

0 commit comments

Comments
 (0)