Commit 950976cf authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Project deploy token: fixed API method, marked webdriver broken

The anticipation that the API would exist was right, but the
checked return code was wrong.

We'll probably won't need to fix the webdriver method
parent cf45afc7c023
......@@ -16,14 +16,14 @@ def test_deploy_token(test_project, public_project, tmpdir):
token1 = token2 = None
# a deploy token for the *other* project does not grant clone permission
token1 = public_project.webdriver_create_deploy_token('test_token_1')
token1 = public_project.api_create_deploy_token('test_token_1')
code, _, err = clone.hg_unchecked(
'pull', test_project.deploy_token_url(token1))
assert code != 0
assert 'HTTP Error 404' in err or 'authorization failed' in err
token2 = test_project.webdriver_create_deploy_token('test_token_2')
token2 = test_project.api_create_deploy_token('test_token_2')
clone.hg('pull', test_project.deploy_token_url(token2))
log = clone.hg('log', '-T', '{desc}:{phase}\n')
assert log.splitlines() == ['Commit 0:public']
......@@ -661,7 +661,7 @@ class Project(object):
resp = self.owner_api_post(subpath='deploy_tokens',
data=dict(name=name,
scopes=scopes))
assert resp.status_code == 200
assert resp.status_code == 201
return resp.json()
def api_delete_deploy_token(self, token):
......@@ -673,6 +673,8 @@ class Project(object):
"""Create a deploy token with Selenium
The API doesn't exist before GitLab 12.9.
This method does not work on GitLab 13.12 anymore. Probably not
a big deal, but we can use the API instead for all current use cases.
:param name: required by GitLab, is only a human intended description
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment