summaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-01-19 23:05:47 +0100
committerNejc Habjan <nejc.habjan@siemens.com>2023-02-16 20:22:10 +0100
commitbe7745dc3dfee64d453287ed7d350adc7e5cadae (patch)
treed2c2134b539893c73b6c6ee31242f3b995e0eb16 /tests/functional
parent1da7c53fd3476a1ce94025bb15265f674af40e1a (diff)
downloadgitlab-feat/oauth2-resource-password-flow.tar.gz
feat(client): replace basic auth with OAuth ROPC flowfeat/oauth2-resource-password-flow
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/api/test_gitlab.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/functional/api/test_gitlab.py b/tests/functional/api/test_gitlab.py
index ced77c2..bde64d3 100644
--- a/tests/functional/api/test_gitlab.py
+++ b/tests/functional/api/test_gitlab.py
@@ -2,6 +2,7 @@ import pytest
import requests
import gitlab
+from gitlab.oauth import PasswordCredentials
@pytest.fixture(
@@ -22,6 +23,13 @@ def test_auth_from_config(gl, gitlab_config, temp_dir):
assert isinstance(test_gitlab.user, gitlab.v4.objects.CurrentUser)
+def test_auth_with_ropc_flow(gl, temp_dir):
+ oauth_credentials = PasswordCredentials("root", "5iveL!fe")
+ test_gitlab = gitlab.Gitlab(gl.url, oauth_credentials=oauth_credentials)
+ test_gitlab.auth()
+ assert isinstance(test_gitlab.user, gitlab.v4.objects.CurrentUser)
+
+
def test_no_custom_session(gl, temp_dir):
"""Test no custom session"""
custom_session = requests.Session()