Skip to content

Commit

Permalink
debug on my phone
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Jul 5, 2022
1 parent 7110c75 commit a6c9318
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions st2common/tests/unit/test_config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,20 +631,26 @@ def test_get_config_dynamic_config_item_under_pattern_properties(self):
config_db.delete()

def test_get_config_dynamic_config_item_properties_order_of_precedence(self):
pack_name = "dummy_pack_schema_with_properties_1"
pack_name = "dummy_pack_schema_with_pattern_and_additional_properties_1"
loader = ContentPackConfigLoader(pack_name=pack_name)

encrypted_value = crypto.symmetric_encrypt(
encrypted_value_1 = crypto.symmetric_encrypt(
KeyValuePairAPI.crypto_key, "v1_encrypted"
)
KeyValuePair.add_or_update(
KeyValuePairDB(name="k1_encrypted", value=encrypted_value, secret=True)
KeyValuePairDB(name="k1_encrypted", value=encrypted_value_1, secret=True)
)
encrypted_value_2 = crypto.symmetric_encrypt(
KeyValuePairAPI.crypto_key, "v2_encrypted"
)
KeyValuePair.add_or_update(
KeyValuePairDB(name="k2_encrypted", value=encrypted_value, secret=True)
KeyValuePairDB(name="k2_encrypted", value=encrypted_value_2, secret=True)
)
encrypted_value_3 = crypto.symmetric_encrypt(
KeyValuePairAPI.crypto_key, "v3_encrypted"
)
KeyValuePair.add_or_update(
KeyValuePairDB(name="k3_encrypted", value=encrypted_value, secret=True)
KeyValuePairDB(name="k3_encrypted", value=encrypted_value_3, secret=True)
)

####################
Expand Down Expand Up @@ -689,6 +695,7 @@ def test_get_config_dynamic_config_item_properties_order_of_precedence(self):
config_db = Config.add_or_update(config_db)

config_rendered = loader.get_config()
print(config_rendered)

self.assertEqual(
config_rendered,
Expand All @@ -711,7 +718,7 @@ def test_get_config_dynamic_config_item_properties_order_of_precedence(self):
"env-prod": {
"host": "127.1.2.7",
"port": 8282,
"token": "v1_encrypted",
"token": "v2_encrypted",
},
"dev": {
"url": "https://example.com",
Expand All @@ -721,7 +728,7 @@ def test_get_config_dynamic_config_item_properties_order_of_precedence(self):
"prod": {
"url": "https://other.example.com",
"port": 2345,
"token": "v1_encrypted",
"token": "v3_encrypted",
},
},
},
Expand Down

0 comments on commit a6c9318

Please sign in to comment.