Skip to content

Commit

Permalink
fix test to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jx2lee committed Feb 5, 2025
1 parent 6b5ed13 commit c7920c9
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions tests/dag_processing/test_dag_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,12 @@ def test_correct_repo_urls(self, conn_id, expected_repo_url):
hook = GitHook(git_conn_id=conn_id)
assert hook.repo_url == expected_repo_url

def test_env_var(self, session):
hook = GitHook(git_conn_id=CONN_DEFAULT)
assert hook.env == {
"GIT_SSH_COMMAND": "ssh -i /files/pkey.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no"
}
def test_env_var_with_configure_hook_env(self, session):
default_hook = GitHook(git_conn_id=CONN_DEFAULT)
with default_hook.configure_hook_env():
assert default_hook.env == {
"GIT_SSH_COMMAND": "ssh -i /files/pkey.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no"
}
db.merge_conn(
Connection(
conn_id="my_git_conn_strict",
Expand All @@ -187,10 +188,11 @@ def test_env_var(self, session):
)
)

hook = GitHook(git_conn_id="my_git_conn_strict")
assert hook.env == {
"GIT_SSH_COMMAND": "ssh -i /files/pkey.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes"
}
strict_default_hook = GitHook(git_conn_id="my_git_conn_strict")
with strict_default_hook.configure_hook_env():
assert strict_default_hook.env == {
"GIT_SSH_COMMAND": "ssh -i /files/pkey.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes"
}

def test_given_both_private_key_and_key_file(self):
db.merge_conn(
Expand All @@ -210,13 +212,14 @@ def test_given_both_private_key_and_key_file(self):
):
GitHook(git_conn_id=CONN_BOTH_PATH_INLINE)

def test_key_file_git_hook_has_env(self):
def test_key_file_git_hook_has_env_with_configure_hook_env(self):
hook = GitHook(git_conn_id=CONN_DEFAULT)

assert hasattr(hook, "env")
assert hook.env == {
"GIT_SSH_COMMAND": "ssh -i /files/pkey.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no"
}
with hook.configure_hook_env():
assert hook.env == {
"GIT_SSH_COMMAND": "ssh -i /files/pkey.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no"
}

def test_private_key_lazy_env_var(self):
hook = GitHook(git_conn_id=CONN_ONLY_INLINE_KEY)
Expand Down

0 comments on commit c7920c9

Please sign in to comment.