diff --git a/tests/spec/assets/image_json.pydantic_v1.json b/tests/spec/assets/image_json.pydantic_v1.json new file mode 100644 index 0000000..a7e83bf --- /dev/null +++ b/tests/spec/assets/image_json.pydantic_v1.json @@ -0,0 +1,35 @@ +{ + "created": "2015-10-31T22:22:56.015925+00:00", + "author": "Alyssa P. Hacker <alyspdev@example.com>", + "architecture": "amd64", + "os": "linux", + "config": { + "User": "alice", + "Memory": 2048, + "MemorySwap": 4096, + "CpuShares": 8, + "ExposedPorts": { + "8080/tcp": {} + }, + "Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "FOO=docker_is_a_really", "BAR=great_tool_you_know"], + "Entrypoint": ["/bin/my-app-binary"], + "Cmd": ["--foreground", "--config", "/etc/my-app.d/default.cfg"], + "Volumes": { + "/var/job-result-data": {}, + "/var/log/my-app-logs": {} + }, + "WorkingDir": "/home/alice" + }, + "rootfs": { + "diff_ids": ["sha256:c6f988f4874bb0add23a778f753c65efe992244e148a1d2ec2a8b664fb66bbd1", "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"], + "type": "layers" + }, + "history": [{ + "created": "2015-10-31T22:22:54.690851+00:00", + "created_by": "/bin/sh -c #(nop) ADD file:a3bc1e842b69636f9df5256c49c5374fb4eef1e281fe3f282c65fb853ee171c5 in /" + }, { + "created": "2015-10-31T22:22:55.613815+00:00", + "created_by": "/bin/sh -c #(nop) CMD [\"sh\"]", + "empty_layer": true + }] +} diff --git a/tests/spec/assets/image_json.json b/tests/spec/assets/image_json.pydantic_v2.json similarity index 100% rename from tests/spec/assets/image_json.json rename to tests/spec/assets/image_json.pydantic_v2.json diff --git a/tests/spec/conftest.py b/tests/spec/conftest.py index 867b499..a5200e0 100644 --- a/tests/spec/conftest.py +++ b/tests/spec/conftest.py @@ -32,4 +32,7 @@ def auth_response(): @pytest.fixture def image_json_dict(): - return json.loads((assets / "image_json.json").read_text()) + if __version__.startswith("2."): + return json.loads((assets / "image_json.pydantic_v2.json").read_text()) + else: + return json.loads((assets / "image_json.pydantic_v1.json").read_text())