pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python-gitlab/python-gitlab/commit/67ab24fe5ae10a9f8cc9122b1a08848e8927635d

ous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-5efd63e783ac04bb.css" /> test(functional): simplify token creation · python-gitlab/python-gitlab@67ab24f · GitHub
Skip to content

Commit 67ab24f

Browse files
nejchJohnVillalovos
authored andcommitted
test(functional): simplify token creation
1 parent 346cf76 commit 67ab24f

3 files changed

Lines changed: 9 additions & 26 deletions

File tree

tests/functional/conftest.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,6 @@ def reset_gitlab(gl: gitlab.Gitlab) -> None:
5050
helpers.safe_delete(user, hard_delete=True)
5151

5252

53-
def set_token(container, fixture_dir):
54-
logging.info("Creating API token.")
55-
set_token_rb = fixture_dir / "set_token.rb"
56-
57-
with open(set_token_rb, "r", encoding="utf-8") as f:
58-
set_token_command = f.read().strip()
59-
60-
rails_command = [
61-
"docker",
62-
"exec",
63-
container,
64-
"gitlab-rails",
65-
"runner",
66-
set_token_command,
67-
]
68-
output = check_output(rails_command).decode().strip()
69-
logging.info("Finished creating API token.")
70-
71-
return output
72-
73-
7453
def pytest_report_collectionfinish(config, startdir, items):
7554
return [
7655
"",
@@ -157,7 +136,7 @@ def _wait(timeout=30, step=0.5):
157136

158137

159138
@pytest.fixture(scope="session")
160-
def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, fixture_dir):
139+
def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir):
161140
config_file = temp_dir / "python-gitlab.cfg"
162141
port = docker_services.port_for("gitlab", 80)
163142

@@ -174,15 +153,13 @@ def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, fixture_
174153
f"GitLab container is now ready after {minutes} minute(s), {seconds} seconds"
175154
)
176155

177-
token = set_token("gitlab-test", fixture_dir=fixture_dir)
178-
179156
config = f"""[global]
180157
default = local
181158
timeout = 60
182159
183160
[local]
184161
url = http://{docker_ip}:{port}
185-
private_token = {token}
162+
private_token = python-gitlab-token
186163
api_version = 4"""
187164

188165
with open(config_file, "w", encoding="utf-8") as f:

tests/functional/fixtures/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ services:
3131
gitlab_exporter['enable'] = false
3232
grafana['enable'] = false
3333
letsencrypt['enable'] = false
34+
entrypoint:
35+
- /bin/sh
36+
- -c
37+
- chmod 644 /opt/gitlab/embedded/service/gitlab-rails/db/fixtures/production/* && /assets/wrapper
38+
volumes:
39+
- ${PWD}/tests/functional/fixtures/set_token.rb:/opt/gitlab/embedded/service/gitlab-rails/db/fixtures/production/003_set_token.rb
3440
ports:
3541
- '8080:80'
3642
- '2222:22'

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ skip_missing_interpreters = True
55
envlist = py310,py39,py38,py37,flake8,black,twine-check,mypy,isort,cz,pylint
66

77
[testenv]
8-
passenv = GITLAB_IMAGE GITLAB_TAG PY_COLORS NO_COLOR FORCE_COLOR DOCKER_HOST
8+
passenv = GITLAB_IMAGE GITLAB_TAG PY_COLORS NO_COLOR FORCE_COLOR DOCKER_HOST PWD
99
setenv = VIRTUAL_ENV={envdir}
1010
whitelist_externals = true
1111
usedevelop = True

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy