Skip to content

Commit

Permalink
test method for get_first_var_set
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed May 12, 2024
1 parent bdd5319 commit 104ccbf
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions megalinter/tests/test_megalinter/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,33 @@ def test_config_secure_env_vars_override_default(self):
"OX_API_KEY is not visible",
)

def test_get_first_var_set(self):
request_id = str(uuid.uuid1())
config.init_config(
request_id,
None,
{
"NOTIF_API_REPORTER_URL": "test",
"TEST_VAR": "test2"
},
)
res = config.get_first_var_set(request_id,["API_REPORTER_URL","NOTIF_API_REPORTER_URL"], None)
self.assertTrue(
res == "test",
"get_first_var_set is failing",
)
res2 = config.get_first_var_set(request_id,["NOPE","NOT_HERE"], "default_value")
self.assertTrue(
res2 == "default_value",
"get_first_var_set is failing with default value",
)
res3 = config.get_first_var_set(request_id,["TEST_VAR","TEST_VAR_2"], None)
self.assertTrue(
res3 == "test2",
"get_first_var_set is failing",
)


def replace_branch_in_input_files(self):
root = (
".automation"
Expand Down

0 comments on commit 104ccbf

Please sign in to comment.