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)
| 110 | ), |
| 111 | ) |
| 112 | def 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( |
nothing calls this directly
no test coverage detected