File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/layers/domain/core/cpm_system_id/tests Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ boto3-stubs = { extras = [
5656], version = " ^1.34.37" }
5757pytest-timeout = " ^2.2.0"
5858lz4 = " ^4.3.3"
59+ pytest-repeat = " ^0.9.3"
5960
6061[tool .poetry .group .local ]
6162optional = true
Original file line number Diff line number Diff line change 1+ import os
2+ from pathlib import Path
3+
14import pytest
25from domain .core .cpm_system_id import AsidId , PartyKeyId , ProductId
6+ from event .json import json_load
7+
8+ PATH_TO_CPM_SYSTEM_IDS = Path (__file__ ).parent .parent
9+ PRODUCT_IDS_GENERATED_FILE = f"{ PATH_TO_CPM_SYSTEM_IDS } /generated_ids/product_ids.json"
10+ generated_product_ids = set ()
11+
12+
13+ @pytest .fixture (scope = "module" , autouse = True )
14+ def _get_generated_ids ():
15+ global generated_product_ids
16+ if os .path .exists (PRODUCT_IDS_GENERATED_FILE ):
17+ with open (PRODUCT_IDS_GENERATED_FILE , "r" ) as file :
18+ generated_product_ids = set (json_load (file ))
319
420
521def test_party_key_generator_format_key ():
@@ -71,9 +87,11 @@ def test_asid_generator_increment_number():
7187 assert generator .id == "223456789013"
7288
7389
90+ @pytest .mark .repeat (50 )
7491def test_product_id_generator_format_key ():
7592 generator = ProductId .create ()
7693 assert generator .id is not None
94+ assert generator .id not in generated_product_ids
7795
7896
7997@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments