mirror of
https://github.com/d9pouces/id_configurator.git
synced 2026-11-09 01:47:21 +01:00
feat: can specify several users to configure
Signed-off-by: d9pouces <github@19pouces.net>
This commit is contained in:
@@ -63,6 +63,48 @@ def test_apply_writes_nuget_config(tmp_path) -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_apply_marks_non_https_source_as_insecure(tmp_path) -> None:
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"nuget": {
|
||||
"repositories": [{"name": "demo", "url": "http://example.invalid/"}]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=make_config(data), dst=dst, src=None)
|
||||
|
||||
NuGetModule().apply(context)
|
||||
|
||||
content = (dst / "root/.nuget/NuGet/NuGet.Config").read_text(encoding="utf-8")
|
||||
assert content == (
|
||||
'<?xml version="1.0" encoding="utf-8"?>\n'
|
||||
"<configuration>\n"
|
||||
" <packageSources>\n"
|
||||
" <clear />\n"
|
||||
' <add key="demo" value="http://example.invalid/" allowInsecureConnections="true" />\n'
|
||||
" </packageSources>\n"
|
||||
"</configuration>\n"
|
||||
)
|
||||
|
||||
|
||||
def test_apply_writes_config_for_each_configured_user(tmp_path) -> None:
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(
|
||||
config=make_config(CONFIG_WITH_REPO), dst=dst, src=None, users=["alice", "root"]
|
||||
)
|
||||
|
||||
NuGetModule().apply(context)
|
||||
|
||||
root_content = (dst / "root/.nuget/NuGet/NuGet.Config").read_text(encoding="utf-8")
|
||||
alice_content = (dst / "home/alice/.nuget/NuGet/NuGet.Config").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
assert alice_content == root_content
|
||||
|
||||
|
||||
def test_apply_writes_multiple_sources_in_order(tmp_path) -> None:
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=make_config(CONFIG_WITH_TWO_REPOS), dst=dst, src=None)
|
||||
|
||||
Reference in New Issue
Block a user