def configuration_with_multiple_levels_and_lists(): config_yaml = """ --- projects_and_groups: "*": merge_requests: approvals: approvals_before_merge: 3 approvers: - common_approvers "some_group/*": merge_requests: approvals: reset_approvals_on_push: true approvers: - group_approvers "some_group/my_project": merge_requests: approvals: reset_approvals_on_push: false disable_overriding_approvers_per_merge_request: true approvers: - project_approvers """ return ConfigurationProjectsAndGroups(config_string=config_yaml)
def test_error_on_missing_key(): config_yaml = """ --- # no key at all """ with pytest.raises(SystemExit) as e: configuration = ConfigurationProjectsAndGroups( config_string=config_yaml) NonEmptyConfigsProvider(configuration, None, None) assert e.value.code == EXIT_INVALID_INPUT
def configuration_with_subgroups_and_projects(): config_yaml = """ --- projects_and_groups: some_group/*: project_settings: foo: bar hooks: a: foo: bar some_group/subgroup_level_1/*: project_settings: foo: bar2 hooks: a: foo: bar2 some_group/subgroup_level_1/subgroup_level_2/*: project_settings: foo: bar3 hooks: a: foo: bar3 some_group/some_project: project_settings: bar: something_else hooks: b: bar: something_else some_group/subgroup_level_1/some_project: project_settings: bar: something_else2 hooks: b: bar: something_else2 some_group/subgroup_level_1/subgroup_level_2/some_project: project_settings: bar: something_else3 hooks: b: bar: something_else3 """ return ConfigurationProjectsAndGroups(config_string=config_yaml)
def configuration_with_subgroups(): config_yaml = """ --- projects_and_groups: some_group/*: group_members: my-user: access_level: 10 enforce_group_members: true some_group/subgroup/*: group_members: my-user2: access_level: 20 enforce_group_members: true """ return ConfigurationProjectsAndGroups(config_string=config_yaml)
def configuration_for_other_project(): config_yaml = """ --- projects_and_groups: "some_group/*": secret_variables: first: key: foo value: bar "some_group/my_project": secret_variables: second: key: foo value: bar """ return ConfigurationProjectsAndGroups(config_string=config_yaml)
def configuration_with_only_group_and_project(): config_yaml = """ --- projects_and_groups: some_group/*: project_settings: foo: bar hooks: a: foo: bar some_group/some_project: project_settings: bar: foo hooks: b: bar: foo """ return ConfigurationProjectsAndGroups(config_string=config_yaml)