|
| 1 | +# Copyright 2023 CRS4. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +from runcrate.utils import parse_img |
| 16 | + |
| 17 | + |
| 18 | +def test_parse_img(): |
| 19 | + assert parse_img("python") == { |
| 20 | + "registry": "docker.io", |
| 21 | + "name": "python" |
| 22 | + } |
| 23 | + assert parse_img("python:3.12") == { |
| 24 | + "registry": "docker.io", |
| 25 | + "name": "python", |
| 26 | + "tag": "3.12" |
| 27 | + } |
| 28 | + assert parse_img("josiah/python:3.11") == { |
| 29 | + "registry": "docker.io", |
| 30 | + "name": "josiah/python", |
| 31 | + "tag": "3.11" |
| 32 | + } |
| 33 | + assert parse_img("quay.io/josiah/python:3.11") == { |
| 34 | + "registry": "quay.io", |
| 35 | + "name": "josiah/python", |
| 36 | + "tag": "3.11" |
| 37 | + } |
| 38 | + assert parse_img("python@sha256:7b8d65a924f596eb65306214f559253c468336bcae09fd575429774563460caf") == { |
| 39 | + "registry": "docker.io", |
| 40 | + "name": "python", |
| 41 | + "sha256": "7b8d65a924f596eb65306214f559253c468336bcae09fd575429774563460caf" |
| 42 | + } |
0 commit comments