Skip to content

Commit d72c813

Browse files
committed
Unit tests
1 parent 781d2a1 commit d72c813

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

src/api/tests/feature_tests/features/createProductTeam.success.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Feature: Create Product Team - success scenarios
4343
| keys.0.key_type | product_team_id_alias |
4444
| keys.0.key_value | FOOBAR |
4545

46-
Scenario: Successfully create a ProductTeam with duplicated keys
46+
Scenario: Successfully create a ProductTeam by removing the duplicated keys
4747
When I make a "POST" request with "default" headers to "ProductTeam" with body:
4848
| path | value |
4949
| name | My Great Product Team |

src/api/tests/feature_tests/features/createProductTeamEpr.success.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Feature: Create EPR Product Team - success scenarios
4343
| keys.0.key_type | product_team_id_alias |
4444
| keys.0.key_value | FOOBAR |
4545

46-
Scenario: Successfully create an EPR ProductTeam with duplicated keys
46+
Scenario: Successfully create an EPR ProductTeam by removing the duplicated keys
4747
When I make a "POST" request with "default" headers to "ProductTeamEpr" with body:
4848
| path | value |
4949
| name | My Great Product Team |

src/layers/domain/core/cpm_system_id/tests/test_cpm_system_id_v1.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
from pathlib import Path
33

44
import pytest
5-
from domain.core.cpm_system_id import AsidId, PartyKeyId, ProductId
5+
from domain.core.cpm_system_id import (
6+
PRODUCT_TEAM_EPR_ID_PATTERN,
7+
PRODUCT_TEAM_ID_PATTERN,
8+
AsidId,
9+
PartyKeyId,
10+
ProductId,
11+
ProductTeamId,
12+
)
613
from event.json import json_load
714

815
PATH_TO_CPM_SYSTEM_IDS = Path(__file__).parent.parent
@@ -18,6 +25,28 @@ def _get_generated_ids():
1825
generated_product_ids = set(json_load(file))
1926

2027

28+
def test_cpm_product_team_id_generator():
29+
generator = ProductTeamId.create()
30+
assert PRODUCT_TEAM_ID_PATTERN.match(generator.id)
31+
32+
33+
def test_epr_product_team_id_generator():
34+
generator = ProductTeamId.create(ods_code="ABC")
35+
assert PRODUCT_TEAM_EPR_ID_PATTERN.match(generator.id)
36+
37+
38+
def test_cpm_product_tema_id_validate_id_valid():
39+
valid_key = "3150ac97-45d0-40f6-904f-c6422c46e711"
40+
is_valid = ProductTeamId.validate(valid_key)
41+
assert is_valid
42+
43+
44+
def test_epr_product_tema_id_validate_id_valid():
45+
valid_key = "ABC.3150ac97-45d0-40f6-904f-c6422c46e711"
46+
is_valid = ProductTeamId.validate(valid_key)
47+
assert is_valid
48+
49+
2150
def test_party_key_generator_format_key():
2251
generator = PartyKeyId.create(current_number=123456, ods_code="ABC")
2352
expected_key = "ABC-123457" # Expecting the number to be formatted with 6 digits

0 commit comments

Comments
 (0)