Add test for valid & invalid docker image names
MODIFY
repo2docker/__main__.py
repo2docker/__main__.py
@@ -5,7 +5,7 @@ import logging
import docker
from .app import Repo2Docker
from . import __version__
-from .utils import validate_and_generate_port_mapping
+from .utils import validate_and_generate_port_mapping, is_valid_docker_image_name
def validate_image_name(image_name):
"""

MODIFY
tests/test_args.py
tests/test_args.py
@@ -77,3 +77,11 @@ def test_clean():
assert not make_r2d(['.']).cleanup_checkout
# Don't clean when repo exists locally and we explicitly ask it to not clean
assert not make_r2d(['--no-clean', '.']).cleanup_checkout
+
+
+def test_invalid_image_name():
+ """
+ Test validating image names
+ """
+ with pytest.raises(SystemExit):
+ make_r2d(['--image-name', '_invalid', '.'])
\ No newline at end of file

Add test for valid & invalid docker image names