From b95475c1f98fb414e8a5a9c7bc3ab26aaf4cac22 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 14 Nov 2014 08:47:41 -0800 Subject: [PATCH] Unittest the get_split_image_tag function in the docker module --- lib/ansible/modules/core | 2 +- test/units/module_tests/TestDocker.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/units/module_tests/TestDocker.py diff --git a/lib/ansible/modules/core b/lib/ansible/modules/core index 6be2fbb1c5..c6522620c5 160000 --- a/lib/ansible/modules/core +++ b/lib/ansible/modules/core @@ -1 +1 @@ -Subproject commit 6be2fbb1c577d34b0dbb51c7338da0b79286658f +Subproject commit c6522620c562d24031ad32187de83c3768df3c77 diff --git a/test/units/module_tests/TestDocker.py b/test/units/module_tests/TestDocker.py new file mode 100644 index 0000000000..f381620346 --- /dev/null +++ b/test/units/module_tests/TestDocker.py @@ -0,0 +1,20 @@ +import collections +import mock +import os +import unittest + +from ansible.modules.core.cloud.docker.docker import get_split_image_tag + +class DockerSplitImageTagTestCase(unittest.TestCase): + + def test_trivial(self): + self.assertEqual(get_split_image_tag('test'), ('test', 'latest')) + + def test_with_org_name(self): + self.assertEqual(get_split_image_tag('ansible/centos7-ansible'), ('ansible/centos7-ansible', 'latest')) + + def test_with_tag(self): + self.assertEqual(get_split_image_tag('test:devel'), ('test', 'devel')) + + def test_with_tag_and_org_name(self): + self.assertEqual(get_split_image_tag('ansible/centos7-ansible:devel'), ('ansible/centos7-ansible', 'devel'))