repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
gitlabform/gitlabform
import pytest from gitlabform import EXIT_INVALID_INPUT from gitlabform.configuration import Configuration def test__config_with_different_case_duplicate_groups(): config_yaml = """ projects_and_groups: groupnamewithvaryingcase/*: project_settings: visibility: internal GROUPnameW...
SystemExit)
pytest.raises
variable
tests/unit/configuration/test_case_sensitivity.py
test__config_with_different_case_duplicate_groups
52
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( allowed_codes, run_gitlabform, ) def one_owner_and_two_developers(group, root_user, users): yield from one_owner_and_two_developers_for_group_non_fixture(group, root_user, users) def one_owner_and_two_developers_group_...
3
assert
numeric_literal
tests/acceptance/standard/test_group_members_users.py
test__change_owner
TestGroupMembersUsers
205
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( run_gitlabform, randomize_case, allowed_codes, ) def one_owner_and_two_developers(group, root_user, users): group.members.create({"user_id": users[0].id, "access_level": AccessLevel.OWNER.value}) group.members.c...
no_of_members_before + 1
assert
complex_expr
tests/acceptance/standard/test_group_members_case_insensitive.py
test__user_case_insensitive
TestGroupMembersCaseInsensitive
83
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform, gl pytestmark = pytest.mark.requires_license class TestMergeRequestApprovalsSettings: def test__fail(self, project, make_user): config = f""" projects_and_groups: {project.path_with_namespace}: project_settings: ...
SystemExit)
pytest.raises
variable
tests/acceptance/premium/test_merge_request_approvals_settings.py
test__fail
TestMergeRequestApprovalsSettings
58
null
gitlabform/gitlabform
import pytest import time import gitlab from gitlabform.gitlab import AccessLevel from tests.acceptance import get_only_branch_access_levels, run_gitlabform pytestmark = pytest.mark.requires_license class TestBranches: def test__branch_protection_dependent_on_members( self, project_for_function, group_...
sorted([group_for_function.id])
assert
func_call
tests/acceptance/premium/test_branches.py
test__branch_protection_dependent_on_members
TestBranches
215
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( run_gitlabform, randomize_case, allowed_codes, ) def one_owner_and_two_developers(group, root_user, users): group.members.create({"user_id": users[0].id, "access_level": AccessLevel.OWNER.value}) group.members.c...
2
assert
numeric_literal
tests/acceptance/standard/test_group_members_case_insensitive.py
test__group_case_insensitive
TestGroupMembersCaseInsensitive
111
null
gitlabform/gitlabform
from tests.acceptance import run_gitlabform class TestGroupVariables: def test__delete_variable(self, group_for_function): config_single_variable = f""" projects_and_groups: {group_for_function.full_path}/*: group_variables: foo: key: FOO ...
"123"
assert
string_literal
tests/acceptance/standard/test_group_variables.py
test__delete_variable
TestGroupVariables
34
null
gitlabform/gitlabform
import os import pytest import time from typing import cast, Tuple, Generator from gitlab.v4.objects import Project, ProjectRemoteMirror, ProjectBranch, Group from tests.acceptance import run_gitlabform, get_random_name, create_project from tests.acceptance.conftest import GitLabFormLogs def mirror_target_projects(ot...
True
assert
bool_literal
tests/acceptance/standard/test_remote_mirrors.py
test_remote_mirrors_create
TestRemoteMirrorsProcessor
159
null
gitlabform/gitlabform
import logging from tests.acceptance import run_gitlabform class TestApplicationSettings: def test__can_set_2fa_application_settings(self, gl, project): initial_settings = gl.settings.get() assert initial_settings is not
None
assert
none_literal
tests/acceptance/standard/test_application_settings.py
test__can_set_2fa_application_settings
TestApplicationSettings
9
null
gitlabform/gitlabform
import logging import pytest from typing import TYPE_CHECKING from gitlab.v4.objects import ProjectHook from tests.acceptance import run_gitlabform, get_random_name def urls(): first_name = get_random_name("hook") second_name = get_random_name("hook") third_name = get_random_name("hook") first_url = f...
(True, True)
assert
collection
tests/acceptance/standard/test_hooks.py
test_hooks_create
TestHooksProcessor
64
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( allowed_codes, run_gitlabform, ) def one_owner_and_two_developers(group, root_user, users): yield from one_owner_and_two_developers_for_group_non_fixture(group, root_user, users) def one_owner_and_two_developers_group_...
"root"
assert
string_literal
tests/acceptance/standard/test_group_members_users.py
test__root_as_the_sole_owner
TestGroupMembersUsers
283
null
gitlabform/gitlabform
import pytest from gitlab import GitlabGetError, GitlabListError from gitlabform.gitlab.core import UnexpectedResponseException, NotFoundException from tests.acceptance import run_gitlabform class TestVariables: def test__variables_with_env_scope(self, project): config_more_variables = f""" proj...
variables_keys
assert
variable
tests/acceptance/standard/test_variables.py
test__variables_with_env_scope
TestVariables
184
null
gitlabform/gitlabform
import pytest import gitlab from gitlabform.gitlab import AccessLevel from tests.acceptance import get_only_tag_access_levels, run_gitlabform pytestmark = pytest.mark.requires_license class TestTags: def test__allowed_to_create_by_user_only(self, project, tag, make_user): user1 = make_user(AccessLevel.DE...
[]
assert
collection
tests/acceptance/premium/test_tags.py
test__allowed_to_create_by_user_only
TestTags
36
null
gitlabform/gitlabform
import pytest import time import gitlab from gitlabform.gitlab import AccessLevel from tests.acceptance import get_only_branch_access_levels, run_gitlabform pytestmark = pytest.mark.requires_license class TestBranches: def test__code_owners_approval(self, project, branch): try: protected_bra...
True
assert
bool_literal
tests/acceptance/premium/test_branches.py
test__code_owners_approval
TestBranches
36
null
gitlabform/gitlabform
import pytest from gitlabform import EXIT_INVALID_INPUT from gitlabform.configuration import Configuration def test__config_with_different_case_project(): group_and_project_name_with_varying_case = "GroupNameWithVaryingCase/projectwithvaryingcase" config_yaml = f""" projects_and_groups: {group_and_p...
{"visibility": "public"}
assert
collection
tests/unit/configuration/test_case_sensitivity.py
test__config_with_different_case_project
38
null
gitlabform/gitlabform
import pytest from gitlab import GitlabGetError, GitlabListError from gitlabform.gitlab.core import UnexpectedResponseException, NotFoundException from tests.acceptance import run_gitlabform class TestVariables: def test__single_variable(self, project): config_single_variable = f""" projects_and...
"123"
assert
string_literal
tests/acceptance/standard/test_variables.py
test__single_variable
TestVariables
51
null
gitlabform/gitlabform
import logging import pytest from typing import TYPE_CHECKING from gitlab.v4.objects import GroupHook from tests.acceptance import run_gitlabform, get_random_name def urls(): first_name = get_random_name("hook") second_name = get_random_name("hook") third_name = get_random_name("hook") first_url = f"h...
(False, True)
assert
collection
tests/acceptance/standard/test_group_hooks.py
test_hooks_create
TestGroupHooksProcessor
55
null
gitlabform/gitlabform
import os import pytest import tempfile import shutil from tests.acceptance import ( run_gitlabform, ) class TestGroupAvatar: def setup_method(self): # Use gitlabform logo self.project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) self.test_image_absolute_p...
SystemExit)
pytest.raises
variable
tests/acceptance/standard/test_group_avatar.py
test__group_avatar_error_continues_with_next_processor
TestGroupAvatar
210
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( run_gitlabform, ) def tags(project): tag_names = [ "tag1", "tag2", "tag3", ] tags = [] for tag_name in tag_names: tag = project.tags.create({"tag_name": tag_name, "ref": "main"})...
SystemExit)
pytest.raises
variable
tests/acceptance/standard/test_tags.py
test__unprotect_unknown_tag
TestTags
126
null
gitlabform/gitlabform
from unittest import TestCase import ez_yaml import pytest from deepdiff import DeepDiff from unittest.mock import MagicMock from gitlabform.constants import APPROVAL_RULE_NAME from gitlabform import EXIT_INVALID_INPUT from gitlabform.configuration import Configuration from gitlabform.configuration.transform import (...
config_after
assert
variable
tests/unit/configuration/transform/test_merge_request_approvals_transformer.py
test__config__with_merge_request_approvals__many_users_and_groups_and_remove
70
null
gitlabform/gitlabform
from typing import List from gitlab import Gitlab from gitlab.v4.objects import Project from tests.acceptance import run_gitlabform class TestProjectSettings: def test__edit_project_settings_topics_default_no_topics_config(self, gl: Gitlab, project: Project) -> None: """ Test that the topics are ...
project_topics
assert
variable
tests/acceptance/standard/test_project_settings.py
test__edit_project_settings_topics_default_no_topics_config
TestProjectSettings
44
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( allowed_codes, run_gitlabform, ) def one_owner(root_user, group, groups, subgroup, users): group.members.create({"user_id": users[0].id, "access_level": AccessLevel.OWNER.value}) group.members.delete(root_user.id) ...
[groups[0].name]
assert
collection
tests/acceptance/standard/test_group_members_groups.py
test__remove_group
TestGroupMembersGroups
117
null
gitlabform/gitlabform
import pytest from gitlab.v4.objects import Project, Group from tests.acceptance import ( run_gitlabform, ) class TestProjectJobTokenScope: def ensure_instance_enforcement_disabled(self, gl): instance_settings = gl.settings.get() original_instance_enforcement = instance_settings.enforce_ci_in...
0
assert
numeric_literal
tests/acceptance/standard/test_job_token_scope.py
test__add_other_project_to_job_token_scope_by_name
TestProjectJobTokenScope
115
null
gitlabform/gitlabform
import logging import pytest from typing import TYPE_CHECKING from gitlab.v4.objects import GroupHook from tests.acceptance import run_gitlabform, get_random_name def urls(): first_name = get_random_name("hook") second_name = get_random_name("hook") third_name = get_random_name("hook") first_url = f"h...
3
assert
numeric_literal
tests/acceptance/standard/test_group_hooks.py
test_hooks_create
TestGroupHooksProcessor
54
null
gitlabform/gitlabform
import pytest from gitlab import GitlabGetError from gitlabform.gitlab.python_gitlab import PythonGitlab from gitlabform.gitlab import GitlabWrapper, GitLab from unittest.mock import MagicMock, patch class TestPythonGitlab: def test_convert_result_to_member_roles_removes_GitlabGraphQl_specific_prefix_from_member...
expected
assert
variable
tests/unit/gitlab/test_python_gitlab.py
test_convert_result_to_member_roles_removes_GitlabGraphQl_specific_prefix_from_member_role_id
TestPythonGitlab
66
null
gitlabform/gitlabform
from tests.acceptance import ( get_random_suffix, run_gitlabform, ) from gitlabform.gitlab import AccessLevel from gitlab import GitlabTransferProjectError import re import pytest class TestTransferProject: def test__transfer_and_archive(self, gl, project_for_function, group, other_group): project...
True
assert
bool_literal
tests/acceptance/standard/test_transfer_project.py
test__transfer_and_archive
TestTransferProject
171
null
gitlabform/gitlabform
from tests.acceptance import run_gitlabform class TestGroupVariables: def test__reset_single_variable(self, group_for_function): config_single_variable = f""" projects_and_groups: {group_for_function.full_path}/*: group_variables: foo: key: FOO ...
"123456"
assert
string_literal
tests/acceptance/standard/test_group_variables.py
test__reset_single_variable
TestGroupVariables
80
null
gitlabform/gitlabform
from tests.acceptance import ( run_gitlabform, ) def get_project_badges(project): badges = project.badges.list(iterator=True) return [badge for badge in badges if badge.kind == "project"] class TestBadges: def test__badges_delete(self, project): config = f""" projects_and_groups: ...
0
assert
numeric_literal
tests/acceptance/standard/test_badges.py
test__badges_delete
TestBadges
55
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( allowed_codes, run_gitlabform, ) def one_owner_and_two_developers(group, root_user, users): yield from one_owner_and_two_developers_for_group_non_fixture(group, root_user, users) def one_owner_and_two_developers_group_...
1
assert
numeric_literal
tests/acceptance/standard/test_group_members_users.py
test__add_user
TestGroupMembersUsers
77
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( run_gitlabform, ) def bot_member(gl, make_project_access_token, project_for_function): token = make_project_access_token(target_project=project_for_function) bot_member = gl.users.get(token.user_id) yield bot_memb...
len(three_members)
assert
func_call
tests/acceptance/standard/test_members_enforce.py
test__enforce
TestMembersEnforce
28
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform from gitlabform.gitlab import AccessLevel pytestmark = pytest.mark.requires_license class TestGroupSamlLinks: def test__add_saml_links(self, gl, group): assert len(group.saml_group_links.list()) ==
0
assert
numeric_literal
tests/acceptance/premium/test_group_saml_links.py
test__add_saml_links
TestGroupSamlLinks
12
null
gitlabform/gitlabform
import os import pytest import time from gitlab import GitlabGetError from gitlabform.gitlab import AccessLevel from tests.acceptance import ( get_only_branch_access_levels, run_gitlabform, DEFAULT_README, ) def no_access_branch(project): branch = project.branches.create({"branch": "no_access_branch"...
"barfoo"
assert
string_literal
tests/acceptance/standard/test_files.py
test__set_file_single_protected_branch_not_all_levels
TestFiles
299
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import run_gitlabform, get_only_environment_access_levels pytestmark = pytest.mark.requires_license class TestProtectedEnvironments: def test__remove_user_from_protected_environment(self, project, make_user) -> str: config = s...
2
assert
numeric_literal
tests/acceptance/premium/test_protected_environments.py
test__remove_user_from_protected_environment
TestProtectedEnvironments
63
null
gitlabform/gitlabform
import logging import pytest from gitlabform.configuration import Configuration logger = logging.getLogger(__name__) def configuration_with_only_group_and_project(): config_yaml = """ --- projects_and_groups: some_group/*: project_settings: foo: bar hooks: a: ...
{}
assert
collection
tests/unit/configuration/test_projects_and_groups.py
test__get_effective_config_for_project__other_project
39
null
gitlabform/gitlabform
from unittest import TestCase import ez_yaml import pytest from deepdiff import DeepDiff from unittest.mock import MagicMock from gitlabform.constants import APPROVAL_RULE_NAME from gitlabform import EXIT_INVALID_INPUT from gitlabform.configuration import Configuration from gitlabform.configuration.transform import (...
SystemExit)
pytest.raises
variable
tests/unit/configuration/transform/test_access_level_transformer.py
test__config__with_access_level_names__invalid_name
203
null
gitlabform/gitlabform
import pytest from gitlabform import EXIT_PROCESSING_ERROR from gitlabform.gitlab import AccessLevel from tests.acceptance import run_gitlabform class TestGroupMembers: def test__add_user_to_group_members_with_custom_role_by_id(self, gl, group_for_function, users, random_string): base_access_level = Acces...
users[0].username
assert
complex_expr
tests/acceptance/ultimate/test_group_members.py
test__add_user_to_group_members_with_custom_role_by_id
TestGroupMembers
29
null
gitlabform/gitlabform
import os import pytest import time from gitlab import GitlabGetError from gitlabform.gitlab import AccessLevel from tests.acceptance import ( get_only_branch_access_levels, run_gitlabform, DEFAULT_README, ) def no_access_branch(project): branch = project.branches.create({"branch": "no_access_branch"...
True
assert
bool_literal
tests/acceptance/standard/test_files.py
test__set_file_specific_branch
TestFiles
88
null
gitlabform/gitlabform
import pytest from tests.acceptance import ( run_gitlabform, ) from pathlib import Path from ruamel.yaml import YAML class TestRunning: def test__ALL(self, gl, project, other_project): config = f""" projects_and_groups: '*': project_settings: request_access_...
True
assert
bool_literal
tests/acceptance/standard/test_running.py
test__ALL
TestRunning
22
null
gitlabform/gitlabform
import pytest from gitlab import GitlabGetError, GitlabListError from gitlabform.gitlab.core import UnexpectedResponseException, NotFoundException from tests.acceptance import run_gitlabform class TestVariables: def test__more_variables(self, project): config_more_variables = f""" projects_and_g...
"bleble"
assert
string_literal
tests/acceptance/standard/test_variables.py
test__more_variables
TestVariables
140
null
gitlabform/gitlabform
from gitlabform.gitlab import AccessLevel from tests.acceptance import get_only_branch_access_levels, run_gitlabform class TestBranches: def test__protect_and_unprotect(self, project, branch): config_protect_branch = f""" projects_and_groups: {project.path_with_namespace}: bra...
None
assert
none_literal
tests/acceptance/standard/test_branches.py
test__protect_and_unprotect
TestBranches
57
null
gitlabform/gitlabform
import pytest from gitlab import GitlabGetError from gitlabform.gitlab.python_gitlab import PythonGitlab from gitlabform.gitlab import GitlabWrapper, GitLab from unittest.mock import MagicMock, patch class TestGitlabWrapperExtraKwargs: @patch("gitlabform.gitlab.GraphQL") @patch("gitlabform.gitlab.PythonGitla...
call_kwargs
assert
variable
tests/unit/gitlab/test_python_gitlab.py
test_max_retries_not_passed_to_gitlab_client
TestGitlabWrapperExtraKwargs
91
null
gitlabform/gitlabform
import pytest from tests.acceptance import allowed_codes, run_gitlabform from gitlabform.gitlab import AccessLevel from gitlabform.constants import APPROVAL_RULE_NAME pytestmark = pytest.mark.requires_license def group_with_one_owner_and_two_developers(other_group, root_user, users): other_group.members.create({...
1
assert
numeric_literal
tests/acceptance/premium/test_merge_request_approvers.py
test__only_users
TestMergeRequestApprovers
78
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import run_gitlabform, get_only_environment_access_levels pytestmark = pytest.mark.requires_license class TestProtectedEnvironments: def test__protect_a_repository_environment(self, project, make_user) -> str: config = f""" ...
"foo"
assert
string_literal
tests/acceptance/premium/test_protected_environments.py
test__protect_a_repository_environment
TestProtectedEnvironments
29
null
gitlabform/gitlabform
from tests.acceptance import ( run_gitlabform, ) def single_true(iterable): i = iter(iterable) # use the fact that thanks to iter() we will "consume" # all the elements of iterable up to the one that is True # so that there should be no other True in the rest return any(i) and not any(i) class...
0
assert
numeric_literal
tests/acceptance/standard/test_deploy_keys.py
test__deploy_key_add_delete_with_enforce
TestDeployKeys
80
null
gitlabform/gitlabform
from tests.acceptance import run_gitlabform class TestGroupSettings: def test__no_edit_needed(self, gl, group): current_value = group.path edit_group_settings = f""" projects_and_groups: {group.full_path}/*: group_settings: path: {curren...
current_value
assert
variable
tests/acceptance/standard/test_group_settings.py
test__no_edit_needed
TestGroupSettings
33
null
gitlabform/gitlabform
import pytest from typing import List from gitlabform.gitlab import AccessLevel from gitlab.v4.objects import User, Project from tests.acceptance import ( run_gitlabform, ) class TestMembers: def test__add_user(self, project, three_members, outsider_user): members_before = project.members.list() ...
len(members_before) + 1
assert
func_call
tests/acceptance/standard/test_members.py
test__add_user
TestMembers
31
null
gitlabform/gitlabform
from tests.acceptance import ( get_random_suffix, run_gitlabform, ) from gitlabform.gitlab import AccessLevel from gitlab import GitlabTransferProjectError import re import pytest class TestTransferProject: def test__transfer_and_update(self, gl, project_for_function, branch_for_function, group, other_gro...
"private"
assert
string_literal
tests/acceptance/standard/test_transfer_project.py
test__transfer_and_update
TestTransferProject
116
null
gitlabform/gitlabform
import pytest from gitlabform import EXIT_PROCESSING_ERROR from gitlabform.gitlab import AccessLevel from tests.acceptance import run_gitlabform class TestGroupMembers: def test__add_user_to_group_members_with_custom_role_by_id(self, gl, group_for_function, users, random_string): base_access_level = Acces...
member_role_id
assert
variable
tests/acceptance/ultimate/test_group_members.py
test__add_user_to_group_members_with_custom_role_by_id
TestGroupMembers
32
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform from gitlabform.gitlab import AccessLevel from gitlab.exceptions import GitlabListError pytestmark = pytest.mark.requires_license class TestGroupLDAPLinks: def test__add_ldap_links(self, gl, group): """Test adding LDAP links to a group.""" ...
"devops"
assert
string_literal
tests/acceptance/premium/test_group_ldap_links.py
test__add_ldap_links
TestGroupLDAPLinks
37
null
gitlabform/gitlabform
from gitlabform.gitlab import AccessLevel def test_group_access_levels_type(): group_access_levels = AccessLevel.group_levels() assert type(group_access_levels[0]) is
int
assert
variable
tests/unit/test_access_levels.py
test_group_access_levels_type
6
null
gitlabform/gitlabform
import os import pytest import time from gitlab import GitlabGetError from gitlabform.gitlab import AccessLevel from tests.acceptance import ( get_only_branch_access_levels, run_gitlabform, DEFAULT_README, ) def no_access_branch(project): branch = project.branches.create({"branch": "no_access_branch"...
[]
assert
collection
tests/acceptance/standard/test_files.py
test__set_file_single_protected_branch
TestFiles
273
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import run_gitlabform, get_only_environment_access_levels pytestmark = pytest.mark.requires_license class TestProtectedEnvironments: def test__unprotect_environment(self, project, make_user): self.test__protect_a_second_reposi...
0
assert
numeric_literal
tests/acceptance/premium/test_protected_environments.py
test__unprotect_environment
TestProtectedEnvironments
105
null
gitlabform/gitlabform
import pytest from gitlab import GitlabGetError, GitlabListError from gitlabform.gitlab.core import UnexpectedResponseException, NotFoundException from tests.acceptance import run_gitlabform class TestVariables: def test__reset_single_variable(self, project): config_single_variable = f""" projec...
"123456"
assert
string_literal
tests/acceptance/standard/test_variables.py
test__reset_single_variable
TestVariables
118
null
gitlabform/gitlabform
import pytest import time from tests.acceptance import run_gitlabform from gitlabform.constants import EXIT_PROCESSING_ERROR def add_gitlab_ci_config(project): add_gitlab_ci_config = f""" projects_and_groups: {project.path_with_namespace}: files: ".gitlab-ci.yml": branches:...
SystemExit
assert
variable
tests/acceptance/standard/test_resource_groups.py
test__resource_group_process_mode_invalid_value
TestResourceGroups
63
null
gitlabform/gitlabform
import datetime from gitlabform.util import to_str def test_date_stringification(): example_project_config = { "members": { "enforce": True, "users": { "project_204_bot": {"access_level": 40}, "project_204_bot_211c9f071a88910e7ed518cc5d81436a": { ...
str
assert
variable
tests/unit/test_utils.py
test_date_stringification
20
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import run_gitlabform, get_only_environment_access_levels pytestmark = pytest.mark.requires_license class TestProtectedEnvironments: def test__protect_a_repository_environment(self, project, make_user) -> str: config = f""" ...
1
assert
numeric_literal
tests/acceptance/premium/test_protected_environments.py
test__protect_a_repository_environment
TestProtectedEnvironments
28
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( allowed_codes, run_gitlabform, ) def one_owner_and_two_developers(group, root_user, users): yield from one_owner_and_two_developers_for_group_non_fixture(group, root_user, users) def one_owner_and_two_developers_group_...
no_of_members_before + 1
assert
complex_expr
tests/acceptance/standard/test_group_members_users.py
test__add_user
TestGroupMembersUsers
74
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import allowed_codes, run_gitlabform pytestmark = pytest.mark.requires_license def group_with_one_owner_and_two_developers(other_group, root_user, users): other_group.members.create({"user_id": users[0].id, "access_level": AccessLevel....
0
assert
numeric_literal
tests/acceptance/premium/test_merge_request_approval_rules.py
test__add_single_rule
TestMergeRequestApprovers
57
null
gitlabform/gitlabform
import os import pytest import time from typing import cast, Tuple, Generator from gitlab.v4.objects import Project, ProjectRemoteMirror, ProjectBranch, Group from tests.acceptance import run_gitlabform, get_random_name, create_project from tests.acceptance.conftest import GitLabFormLogs def mirror_target_projects(ot...
actual_norms
assert
variable
tests/acceptance/standard/test_remote_mirrors.py
test_remote_mirrors_enforce_with_explicit_delete
TestRemoteMirrorsProcessor
711
null
gitlabform/gitlabform
from tests.acceptance import ( run_gitlabform, ) def get_project_badges(project): badges = project.badges.list(iterator=True) return [badge for badge in badges if badge.kind == "project"] class TestBadges: def test__badges_update_choose_the_right_one(self, project): config = f""" ...
2
assert
numeric_literal
tests/acceptance/standard/test_badges.py
test__badges_update_choose_the_right_one
TestBadges
105
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform from gitlabform.gitlab import AccessLevel from gitlab.exceptions import GitlabListError pytestmark = pytest.mark.requires_license class TestGroupLDAPLinks: def test__enforce_ldap_links(self, gl, group): """Test enforce mode for LDAP links config ...
AccessLevel.get_value("developer")
assert
func_call
tests/acceptance/premium/test_group_ldap_links.py
test__enforce_ldap_links
TestGroupLDAPLinks
122
null
gitlabform/gitlabform
import os import pytest import tempfile import shutil from tests.acceptance import ( run_gitlabform, ) class TestGroupAvatar: def setup_method(self): # Use gitlabform logo self.project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) self.test_image_absolute_p...
None
assert
none_literal
tests/acceptance/standard/test_group_avatar.py
test__group_avatar_set_absolute_path
TestGroupAvatar
33
null
gitlabform/gitlabform
from gitlabform.gitlab import AccessLevel from tests.acceptance import get_only_branch_access_levels, run_gitlabform class TestBranches: def test__protect_with_wildcard(self, project): branch_wildcard = "r-*" config_protect_branch = f""" projects_and_groups: {project.path_with_na...
True
assert
bool_literal
tests/acceptance/standard/test_branches.py
test__protect_with_wildcard
TestBranches
150
null
gitlabform/gitlabform
import pytest from tests.acceptance import ( get_random_name, run_gitlabform, ) class TestArchiveProject: def test__dont_edit_archived_project(self, gl, project_for_function, capsys): """ Test that editing files in an archived project is not allowed. To setup the test, we first nee...
SystemExit)
pytest.raises
variable
tests/acceptance/standard/test_archive_project.py
test__dont_edit_archived_project
TestArchiveProject
82
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform pytestmark = pytest.mark.requires_license class TestGroupSettings: def test__can_set_gitlab_duo_flags(self, gl, project, group, subgroup, other_subgroup): instance_settings = gl.settings.get() instance_settings.duo_features_enabled = True ...
True
assert
bool_literal
tests/acceptance/ultimate/test_group_settings.py
test__can_set_gitlab_duo_flags
TestGroupSettings
36
null
gitlabform/gitlabform
import os import pytest import tempfile import shutil from tests.acceptance import ( run_gitlabform, ) class TestProjectAvatar: def setup_method(self): # Use gitlabform logo self.project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) self.test_image_absolute...
SystemExit)
pytest.raises
variable
tests/acceptance/standard/test_project_avatar.py
test__project_avatar_error_continues_with_next_processor
TestProjectAvatar
211
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( run_gitlabform, ) def bot_member(gl, make_project_access_token, project_for_function): token = make_project_access_token(target_project=project_for_function) bot_member = gl.users.get(token.user_id) yield bot_memb...
outsider_user.username
assert
complex_expr
tests/acceptance/standard/test_members_enforce.py
test__enforce
TestMembersEnforce
48
null
gitlabform/gitlabform
import pytest import time from tests.acceptance import run_gitlabform from gitlabform.constants import EXIT_PROCESSING_ERROR def add_gitlab_ci_config(project): add_gitlab_ci_config = f""" projects_and_groups: {project.path_with_namespace}: files: ".gitlab-ci.yml": branches:...
SystemExit)
pytest.raises
variable
tests/acceptance/standard/test_resource_groups.py
test__resource_group_process_mode_invalid_value
TestResourceGroups
60
null
gitlabform/gitlabform
import logging import pytest from gitlabform.configuration import Configuration from gitlabform import EXIT_INVALID_INPUT logger = logging.getLogger(__name__) class TestInheritanceBreakValidation: def test__validate_break_inheritance_flag__invalid_flag_set_at_common_level(self): config_yaml = """ ...
SystemExit)
pytest.raises
variable
tests/unit/configuration/test_inheritance_break_validation.py
test__validate_break_inheritance_flag__invalid_flag_set_at_common_level
TestInheritanceBreakValidation
24
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform from gitlabform.gitlab import AccessLevel pytestmark = pytest.mark.requires_license class TestGroupSamlLinks: def test__enforce_saml_links(self, gl, group_for_function): assert len(group_for_function.saml_group_links.list()) == 0, "saml_group_li...
3
assert
numeric_literal
tests/acceptance/premium/test_group_saml_links.py
test__enforce_saml_links
TestGroupSamlLinks
69
null
gitlabform/gitlabform
import pytest from gitlab.v4.objects import Project, Group from tests.acceptance import ( run_gitlabform, ) class TestProjectJobTokenScope: def ensure_instance_enforcement_disabled(self, gl): instance_settings = gl.settings.get() original_instance_enforcement = instance_settings.enforce_ci_in...
2
assert
numeric_literal
tests/acceptance/standard/test_job_token_scope.py
test__add_other_project_to_job_token_scope_by_name
TestProjectJobTokenScope
111
null
gitlabform/gitlabform
import logging import pytest from gitlabform.configuration import Configuration logger = logging.getLogger(__name__) def configuration_for_skip_groups_skip_projects(): config_yaml = """ --- projects_and_groups: "*": group_settings: one: two project_settings: thre...
"setting"
assert
string_literal
tests/unit/configuration/test_skip_groups_skip_projects.py
test__config_skip_group_configuration
98
null
gitlabform/gitlabform
import pytest from typing import List from gitlabform.gitlab import AccessLevel from gitlab.v4.objects import User, Project from tests.acceptance import ( run_gitlabform, ) class TestMembers: def test__existing_users_are_not_added_again_with_pagination( self, project_for_function: Project, ...
(",").join(members_usernames_from_fixture)
assert
collection
tests/acceptance/standard/test_members.py
test__existing_users_are_not_added_again_with_pagination
TestMembers
98
null
gitlabform/gitlabform
import pytest from unittest.mock import patch, MagicMock class TestGitLabCoreRetryConfiguration: @patch("gitlabform.gitlab.core.requests.Session") @patch("gitlabform.gitlab.core.Configuration") def test_default_retry_configuration(self, mock_configuration, mock_session): """Test that default retry...
True
assert
bool_literal
tests/unit/gitlab/test_core.py
test_default_retry_configuration
TestGitLabCoreRetryConfiguration
41
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( allowed_codes, run_gitlabform, ) def one_owner(root_user, group, groups, subgroup, users): group.members.create({"user_id": users[0].id, "access_level": AccessLevel.OWNER.value}) group.members.delete(root_user.id) ...
0
assert
numeric_literal
tests/acceptance/standard/test_group_members_groups.py
test__remove_all
TestGroupMembersGroups
196
null
gitlabform/gitlabform
import pytest from unittest.mock import patch, MagicMock class TestGitLabCoreRetryConfiguration: @patch("gitlabform.gitlab.core.requests.Session") @patch("gitlabform.gitlab.core.Configuration") def test_custom_retry_configuration(self, mock_configuration, mock_session): """Test that custom retry c...
pytest.approx(0.5)
assert
func_call
tests/unit/gitlab/test_core.py
test_custom_retry_configuration
TestGitLabCoreRetryConfiguration
68
null
gitlabform/gitlabform
import pytest from gitlabform.gitlab import AccessLevel from tests.acceptance import ( allowed_codes, run_gitlabform, ) def one_owner_and_two_developers(group, root_user, users): yield from one_owner_and_two_developers_for_group_non_fixture(group, root_user, users) def one_owner_and_two_developers_group_...
no_of_members_before - 1
assert
complex_expr
tests/acceptance/standard/test_group_members_users.py
test__remove_user
TestGroupMembersUsers
98
null
gitlabform/gitlabform
import pytest from gitlabform.processors.project import schedules_processor def test_invalid_cron_expression(): with pytest.raises(
ValueError)
pytest.raises
variable
tests/unit/processors/test_schedules_processor_extended_cron_pattern.py
test_invalid_cron_expression
35
null
gitlabform/gitlabform
from tests.acceptance import run_gitlabform class TestProjectLabels: def test__updates_existing_label(self, gl, project_for_function): project = gl.projects.get(project_for_function.id) created_label = project.labels.create( { "name": "update_this", "col...
"#0000FF"
assert
string_literal
tests/acceptance/standard/test_project_labels.py
test__updates_existing_label
TestProjectLabels
134
null
gitlabform/gitlabform
import pytest import time from gitlabform.gitlab import AccessLevel from tests.acceptance import ( run_gitlabform, randomize_case, get_only_branch_access_levels, ) pytestmark = pytest.mark.requires_license class TestBranchesUsersCaseInsensitive: def test__users_case_insensitive( self, ...
[AccessLevel.MAINTAINER.value]
assert
collection
tests/acceptance/premium/test_branches_users_case_insensitive.py
test__users_case_insensitive
TestBranchesUsersCaseInsensitive
54
null
gitlabform/gitlabform
import pytest from gitlab import GitlabGetError from tests.acceptance import allowed_codes, run_gitlabform def integrations(project): integrations = ["asana", "slack", "redmine", "jira", "mattermost"] yield integrations # disable test integrations for integration in integrations: with allowe...
0
assert
numeric_literal
tests/acceptance/standard/test_integrations.py
test__if_delete_without_create_works
TestIntegrations
85
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform pytestmark = pytest.mark.requires_license class TestGroupPushRules: def test__create_group_push_rules(self, group): config = f""" projects_and_groups: {group.full_path}/*: group_push_rules: commit_message...
""
assert
string_literal
tests/acceptance/premium/test_group_push_rules.py
test__create_group_push_rules
TestGroupPushRules
22
null
gitlabform/gitlabform
import logging import pytest from typing import TYPE_CHECKING from gitlab.v4.objects import GroupHook from tests.acceptance import run_gitlabform, get_random_name def urls(): first_name = get_random_name("hook") second_name = get_random_name("hook") third_name = get_random_name("hook") first_url = f"h...
1
assert
numeric_literal
tests/acceptance/standard/test_group_hooks.py
test_hooks_enforce
TestGroupHooksProcessor
195
null
gitlabform/gitlabform
from tests.acceptance import run_gitlabform class TestGroupVariables: def test__masked_variables(self, group_for_function): masked_variables = f""" projects_and_groups: {group_for_function.full_path}/*: group_variables: foo: key: FOO ...
"12345678"
assert
string_literal
tests/acceptance/standard/test_group_variables.py
test__masked_variables
TestGroupVariables
117
null
gitlabform/gitlabform
import logging from tests.acceptance import run_gitlabform class TestApplicationSettings: def test__can_set_2fa_application_settings(self, gl, project): initial_settings = gl.settings.get() assert initial_settings is not None assert initial_settings.require_two_factor_authentication is Fal...
True
assert
bool_literal
tests/acceptance/standard/test_application_settings.py
test__can_set_2fa_application_settings
TestApplicationSettings
25
null
gitlabform/gitlabform
import pytest from unittest.mock import patch, MagicMock class TestGitLabCoreRetryConfiguration: @patch("gitlabform.gitlab.core.HTTPAdapter") @patch("gitlabform.gitlab.core.Retry") @patch("gitlabform.gitlab.core.requests.Session") @patch("gitlabform.gitlab.core.Configuration") def test_config_pass...
pytest.approx(0.1)
assert
func_call
tests/unit/gitlab/test_core.py
test_config_passed_to_retry
TestGitLabCoreRetryConfiguration
128
null
gitlabform/gitlabform
import pytest from tests.acceptance import run_gitlabform from gitlabform.gitlab import AccessLevel from gitlab.exceptions import GitlabListError pytestmark = pytest.mark.requires_license class TestGroupLDAPLinks: def test__add_ldap_links(self, gl, group): """Test adding LDAP links to a group.""" ...
1
assert
numeric_literal
tests/acceptance/premium/test_group_ldap_links.py
test__add_ldap_links
TestGroupLDAPLinks
35
null
gitlabform/gitlabform
from tests.acceptance import ( run_gitlabform, ) class TestDeployKeysAllProjects: def test__deploy_key_to_all_projects(self, group, project, other_project, public_ssh_key): deploy_key_to_all_projects = f""" projects_and_groups: "*": deploy_keys: foobar: ...
1
assert
numeric_literal
tests/acceptance/standard/test_deploy_keys_all_projects.py
test__deploy_key_to_all_projects
TestDeployKeysAllProjects
19
null
gitlabform/gitlabform
from tests.acceptance import run_gitlabform class TestGroupLabels: def test__leaves_existing_label_when_enforce_is_false(self, gl, group_for_function): group = gl.groups.get(group_for_function.id) group.labels.create({"name": "delete_this", "color": "red"}) labels = group.labels.list() ...
2
assert
numeric_literal
tests/acceptance/standard/test_group_labels.py
test__leaves_existing_label_when_enforce_is_false
TestGroupLabels
80
null
gitlabform/gitlabform
import pytest from gitlabform import EXIT_INVALID_INPUT from gitlabform.configuration import Configuration from gitlabform.lists.filter import OmitEmptyConfigs def test_error_on_missing_key(): config_yaml = """ --- # no key at all """ with pytest.raises(
SystemExit)
pytest.raises
variable
tests/unit/test_non_empty_configs_provider.py
test_error_on_missing_key
14
null
gitlabform/gitlabform
import pytest from tests.acceptance import ( get_random_name, run_gitlabform, ) class TestArchiveProject: def test__dont_edit_archived_project(self, gl, project_for_function, capsys): """ Test that editing files in an archived project is not allowed. To setup the test, we first nee...
captured.err
assert
complex_expr
tests/acceptance/standard/test_archive_project.py
test__dont_edit_archived_project
TestArchiveProject
86
null
gitlabform/gitlabform
import logging import pytest from tests.acceptance import run_gitlabform def schedules(project): another_branch = "scheduled/new-feature" project.branches.create({"branch": another_branch, "ref": "main"}) # fmt: off schedules = [ ("Existing schedule", "main", "0 * * * *", True), ("Exi...
True
assert
bool_literal
tests/acceptance/standard/test_schedules.py
test__add_new_schedule
TestSchedules
71
null
gitlabform/gitlabform
import logging import pytest from typing import TYPE_CHECKING from gitlab.v4.objects import ProjectHook from tests.acceptance import run_gitlabform, get_random_name def urls(): first_name = get_random_name("hook") second_name = get_random_name("hook") third_name = get_random_name("hook") first_url = f...
3
assert
numeric_literal
tests/acceptance/standard/test_hooks.py
test_hooks_create
TestHooksProcessor
55
null
gitlabform/gitlabform
import pytest from typing import List from gitlabform.gitlab import AccessLevel from gitlab.v4.objects import User, Project from tests.acceptance import ( run_gitlabform, ) class TestMembers: def test__no_groups_and_no_users(self, project): config_with_error = f""" projects_and_groups: ...
SystemExit)
pytest.raises
variable
tests/acceptance/standard/test_members.py
test__no_groups_and_no_users
TestMembers
46
null
gitlabform/gitlabform
import logging import pytest from typing import TYPE_CHECKING from gitlab.v4.objects import ProjectHook from tests.acceptance import run_gitlabform, get_random_name def urls(): first_name = get_random_name("hook") second_name = get_random_name("hook") third_name = get_random_name("hook") first_url = f...
0
assert
numeric_literal
tests/acceptance/standard/test_hooks.py
test_hooks_enforce
TestHooksProcessor
260
null
gitlabform/gitlabform
import pytest from gitlab.v4.objects import Project, Group from tests.acceptance import ( run_gitlabform, ) class TestProjectJobTokenScope: def ensure_instance_enforcement_disabled(self, gl): instance_settings = gl.settings.get() original_instance_enforcement = instance_settings.enforce_ci_in...
1
assert
numeric_literal
tests/acceptance/standard/test_job_token_scope.py
test__add_other_project_to_job_token_scope_by_name
TestProjectJobTokenScope
91
null
gitlabform/gitlabform
import logging import pytest from typing import TYPE_CHECKING from gitlab.v4.objects import ProjectHook from tests.acceptance import run_gitlabform, get_random_name def urls(): first_name = get_random_name("hook") second_name = get_random_name("hook") third_name = get_random_name("hook") first_url = f...
(False, True)
assert
collection
tests/acceptance/standard/test_hooks.py
test_hooks_create
TestHooksProcessor
56
null
gitlabform/gitlabform
from typing import List from gitlab import Gitlab from gitlab.v4.objects import Project from tests.acceptance import run_gitlabform class TestProjectSettings: def test__builds_for_private_projects(self, gl: Gitlab, project: Project) -> None: assert project.visibility ==
"private"
assert
string_literal
tests/acceptance/standard/test_project_settings.py
test__builds_for_private_projects
TestProjectSettings
10
null
gitlabform/gitlabform
import logging from tests.acceptance import run_gitlabform class TestApplicationSettings: def test__can_detect_when_no_changes_required_to_application_settings(self, gl, project, caplog): caplog.set_level(logging.DEBUG) initial_settings = gl.settings.get() initial_settings.require_two_fa...
caplog.text
assert
complex_expr
tests/acceptance/standard/test_application_settings.py
test__can_detect_when_no_changes_required_to_application_settings
TestApplicationSettings
86
null
gitlabform/gitlabform
import pytest from gitlabform import EXIT_PROCESSING_ERROR from gitlabform.gitlab import AccessLevel from tests.acceptance import ( run_gitlabform, ) class TestMembers: def test__cannot_add_user_to_project_with_custom_role_where_custom_role_does_not_exist( self, gl, group, project_for_function, outsi...
SystemExit
assert
variable
tests/acceptance/ultimate/test_members.py
test__cannot_add_user_to_project_with_custom_role_where_custom_role_does_not_exist
TestMembers
126
null