mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Finished Mobilizon OIDC implementation
This commit is contained in:
@@ -18,27 +18,14 @@ class TestGetDockerImage(unittest.TestCase):
|
||||
"akaunting": {
|
||||
"version": "1.0.0",
|
||||
"docker": {
|
||||
"images": { "akaunting": "docker.io/akaunting/akaunting" },
|
||||
"versions": { "akaunting": "2.0.0" }
|
||||
"images": {"akaunting": "docker.io/akaunting/akaunting"},
|
||||
"versions": {"akaunting": "2.0.0"}
|
||||
}
|
||||
}
|
||||
}
|
||||
result = self.get_docker_image(applications, "akaunting", "akaunting")
|
||||
self.assertEqual(result, "docker.io/akaunting/akaunting:2.0.0")
|
||||
|
||||
def test_fallback_to_application_version(self):
|
||||
applications = {
|
||||
"akaunting": {
|
||||
"version": "1.2.3",
|
||||
"docker": {
|
||||
"images": { "akaunting": "ghcr.io/akaunting/akaunting" },
|
||||
"versions": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
result = self.get_docker_image(applications, "akaunting", "akaunting")
|
||||
self.assertEqual(result, "ghcr.io/akaunting/akaunting:1.2.3")
|
||||
|
||||
def test_missing_image_raises_error(self):
|
||||
applications = {
|
||||
"akaunting": {
|
||||
@@ -56,7 +43,7 @@ class TestGetDockerImage(unittest.TestCase):
|
||||
applications = {
|
||||
"akaunting": {
|
||||
"docker": {
|
||||
"images": { "akaunting": "some/image" },
|
||||
"images": {"akaunting": "some/image"},
|
||||
"versions": {}
|
||||
}
|
||||
}
|
||||
@@ -64,5 +51,45 @@ class TestGetDockerImage(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
self.get_docker_image(applications, "akaunting", "akaunting")
|
||||
|
||||
# --- new: Default image_key uses application_id if none provided ---
|
||||
def test_default_image_key_uses_application_id(self):
|
||||
applications = {
|
||||
"myapp": {
|
||||
"version": "3.0.0",
|
||||
"docker": {
|
||||
"images": {"myapp": "registry/myapp"},
|
||||
"versions": {"myapp": "4.5.6"}
|
||||
}
|
||||
}
|
||||
}
|
||||
# No image_key argument → falls back to application_id
|
||||
result = self.get_docker_image(applications, "myapp")
|
||||
self.assertEqual(result, "registry/myapp:4.5.6")
|
||||
|
||||
# --- new: Alternate image_key lookup ---
|
||||
def test_alternate_image_key(self):
|
||||
applications = {
|
||||
"service": {
|
||||
"version": "9.9.9",
|
||||
"docker": {
|
||||
"images": {
|
||||
"service": "registry/service",
|
||||
"db": "registry/service-db"
|
||||
},
|
||||
"versions": {
|
||||
"db": "2.2.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result = self.get_docker_image(applications, "service", "db")
|
||||
self.assertEqual(result, "registry/service-db:2.2.2")
|
||||
|
||||
# --- new: Missing application raises error ---
|
||||
def test_missing_application_raises_error(self):
|
||||
applications = {}
|
||||
with self.assertRaises(ValueError):
|
||||
self.get_docker_image(applications, "does_not_exist")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user