diff options
author | John L. Villalovos <john@sodarock.com> | 2021-11-29 20:57:05 -0800 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-11-29 20:59:53 -0800 |
commit | 86ab04e54ea4175f10053decfad5086cda7aa024 (patch) | |
tree | 083fefada982c795e2415092794db429abb0c184 /tests/unit/test_gitlab_auth.py | |
parent | 5a1678f43184bd459132102cc13cf8426fe0449d (diff) | |
download | gitlab-86ab04e54ea4175f10053decfad5086cda7aa024.tar.gz |
Close-out `master` branchjlvillal/dead_master
Until we delete the `master` branch, delete all content except a short
README that tells people to use the `main` branch.
Diffstat (limited to 'tests/unit/test_gitlab_auth.py')
-rw-r--r-- | tests/unit/test_gitlab_auth.py | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/tests/unit/test_gitlab_auth.py b/tests/unit/test_gitlab_auth.py deleted file mode 100644 index 314fbed..0000000 --- a/tests/unit/test_gitlab_auth.py +++ /dev/null @@ -1,85 +0,0 @@ -import pytest -import requests - -from gitlab import Gitlab - - -def test_invalid_auth_args(): - with pytest.raises(ValueError): - Gitlab( - "http://localhost", - api_version="4", - private_token="private_token", - oauth_token="bearer", - ) - with pytest.raises(ValueError): - Gitlab( - "http://localhost", - api_version="4", - oauth_token="bearer", - http_username="foo", - http_password="bar", - ) - with pytest.raises(ValueError): - Gitlab( - "http://localhost", - api_version="4", - private_token="private_token", - http_password="bar", - ) - with pytest.raises(ValueError): - Gitlab( - "http://localhost", - api_version="4", - private_token="private_token", - http_username="foo", - ) - - -def test_private_token_auth(): - gl = Gitlab("http://localhost", private_token="private_token", api_version="4") - assert gl.private_token == "private_token" - assert gl.oauth_token is None - assert gl.job_token is None - assert gl._http_auth is None - assert "Authorization" not in gl.headers - assert gl.headers["PRIVATE-TOKEN"] == "private_token" - assert "JOB-TOKEN" not in gl.headers - - -def test_oauth_token_auth(): - gl = Gitlab("http://localhost", oauth_token="oauth_token", api_version="4") - assert gl.private_token is None - assert gl.oauth_token == "oauth_token" - assert gl.job_token is None - assert gl._http_auth is None - assert gl.headers["Authorization"] == "Bearer oauth_token" - assert "PRIVATE-TOKEN" not in gl.headers - assert "JOB-TOKEN" not in gl.headers - - -def test_job_token_auth(): - gl = Gitlab("http://localhost", job_token="CI_JOB_TOKEN", api_version="4") - assert gl.private_token is None - assert gl.oauth_token is None - assert gl.job_token == "CI_JOB_TOKEN" - assert gl._http_auth is None - assert "Authorization" not in gl.headers - assert "PRIVATE-TOKEN" not in gl.headers - assert gl.headers["JOB-TOKEN"] == "CI_JOB_TOKEN" - - -def test_http_auth(): - gl = Gitlab( - "http://localhost", - private_token="private_token", - http_username="foo", - http_password="bar", - api_version="4", - ) - assert gl.private_token == "private_token" - assert gl.oauth_token is None - assert gl.job_token is None - assert isinstance(gl._http_auth, requests.auth.HTTPBasicAuth) - assert gl.headers["PRIVATE-TOKEN"] == "private_token" - assert "Authorization" not in gl.headers |