Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema,tests: add support for new system usernames #3964

Merged
merged 4 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/main' into system-usernames-azio…
…tedge
  • Loading branch information
mr-cal committed Nov 8, 2022
commit 066c2959d32ed56d989f02f60c52884780fe4d47
1 change: 1 addition & 0 deletions tests/unit/meta/test_snap_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def test_complex_snap_yaml(complex_project, new_dir):
snap_aziotedge: shared
snap_aziotdu:
scope: shared
provenance: test-provenance-1
"""
)

Expand Down
33 changes: 4 additions & 29 deletions tests/unit/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,12 @@ def test_app_sockets_valid_socket_mode(self, socket_mode, socket_yaml_data):
[
{"snap_daemon": {"scope": "shared"}},
{"snap_microk8s": {"scope": "shared"}},
{"snap_aziotedge": {"scope": "shared"}},
{"snap_aziotdu": {"scope": "shared"}},
{"snap_daemon": "shared"},
{"snap_microk8s": "shared"},
{"snap_aziotedge": "shared"},
{"snap_aziotdu": "shared"},
],
)
def test_project_system_usernames_valid(self, system_username, project_yaml_data):
Expand Down Expand Up @@ -1187,35 +1191,6 @@ def test_grammar_syntax_error(self, project_yaml_data):
with pytest.raises(errors.ProjectValidationError, match=error):
GrammarAwareProject.validate_grammar(data)

@pytest.mark.parametrize(
"system_username",
[
{"snap_daemon": {"scope": "shared"}},
{"snap_microk8s": {"scope": "shared"}},
{"snap_aziotedge": {"scope": "shared"}},
{"snap_aziotdu": {"scope": "shared"}},
{"snap_daemon": "shared"},
{"snap_microk8s": "shared"},
{"snap_aziotedge": "shared"},
{"snap_aziotdu": "shared"},
],
)
def test_project_system_usernames_valid(self, system_username, project_yaml_data):
project = Project.unmarshal(project_yaml_data(system_usernames=system_username))
assert project.system_usernames == system_username

@pytest.mark.parametrize(
"system_username",
[
0,
"string",
],
)
def test_project_system_usernames_invalid(self, system_username, project_yaml_data):
error = "- value is not a valid dict"
with pytest.raises(errors.ProjectValidationError, match=error):
Project.unmarshal(project_yaml_data(system_usernames=system_username))


def test_get_snap_project_with_base(snapcraft_yaml):
project = Project.unmarshal(snapcraft_yaml(base="core22"))
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.