Skip to content

Commit

Permalink
Add test on labels_tags
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Nov 27, 2023
1 parent 71dc7ff commit b4ba32a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,21 @@ def test_create_price_code_category_exclusive_validation(user):
assert response.status_code == 422


def test_create_price_labels_tags_pattern_validation(user):
# product_code cannot be an empty string, nor contain letters
WRONG_PRICE_LABELS_TAGS = [[]]
for wrong_price_labels_tags in WRONG_PRICE_LABELS_TAGS:
PRICE_WITH_PRODUCT_CODE_ERROR = PRICE_1.model_copy(
update={"labels_tags": wrong_price_labels_tags}
)
response = client.post(
"/prices",
json=jsonable_encoder(PRICE_WITH_PRODUCT_CODE_ERROR),
headers={"Authorization": f"Bearer {user.token}"},
)
assert response.status_code == 422


def test_get_prices():
response = client.get("/prices")
assert response.status_code == 200
Expand Down

0 comments on commit b4ba32a

Please sign in to comment.