MCPcopy
hub / github.com/GitGuardian/ggshield / test_ci_no_env

Function test_ci_no_env

tests/unit/core/scan/test_scan_context.py:112–130  ·  view source on GitHub ↗

GIVEN a repository with a remote url WHEN there is no repository url in the environment THEN the remote url is sent by default

(env, fake_url_repo: Repository)

Source from the content-addressed store, hash-verified

110 ),
111)
112def test_ci_no_env(env, fake_url_repo: Repository) -> None:
113 """
114 GIVEN a repository with a remote url
115 WHEN there is no repository url in the environment
116 THEN the remote url is sent by default
117 """
118 # Copying the path is needed for windows to find git
119 environ = {
120 "PATH": os.environ.get("PATH", ""),
121 "GITGUARDIAN_API_KEY": os.environ.get("GITGUARDIAN_API_KEY", ""),
122 **env,
123 }
124 with mock.patch.dict(os.environ, environ, clear=True):
125 context = ScanContext(
126 scan_mode=ScanMode.PATH,
127 command_path="ggshield secret scan path",
128 target_path=fake_url_repo.path,
129 )
130 _assert_repo_url_in_headers(context, EXPECTED_HEADER_REMOTE)
131
132
133@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

ScanContextClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected