Exemplo n.º 1
0
 def convert(self, value, param, ctx):
     try:
         return DockerImage(value)
     except Exception as e:
         self.fail(
             f"{e}. Invalid '{value}' Please indicate image in the form 'account[/image[:tag]]' "
         )
Exemplo n.º 2
0
def test_dockerimage_error():
    with pytest.raises(Exception):
        DockerImage("bitcaster:1.0")
Exemplo n.º 3
0
def test_dockerimage_account():
    with pytest.raises(ValueError):
        DockerImage("bitcaster")
Exemplo n.º 4
0
def test_dockerimage_default():
    i = DockerImage("bitcaster/bitcaster")
    assert i.account == 'bitcaster'
    assert i.image == 'bitcaster'
    assert i.tag == ''
Exemplo n.º 5
0
def test_dockerimage():
    i = DockerImage("bitcaster/bitcaster:1.0")
    assert i.account == 'bitcaster'
    assert i.image == 'bitcaster'
    assert i.tag == '1.0'
Exemplo n.º 6
0
def test_dockerimage_customrepo():
    i = DockerImage("gilab.com/bitcaster/bitcaster")
    assert i.repo == 'gilab.com'
    assert i.account == 'bitcaster'
    assert i.image == 'bitcaster'
    assert i.tag == 'latest'