Example #1
0
 def test_basic(self):
     services = parse_config('{ "services": { "service1": { "git_repo": "abc", "docker_repo": "def", "build_dir": "ghi" } } }')
     assert_equal(1, len(services))
     assert_equal("service1", services[0].name)
     assert_equal("abc", services[0].git_url)
     assert_equal("def", services[0].docker_repo)
     assert_equal("ghi", services[0].build_dir)
Example #2
0
    def test_template(self):
        services = parse_config('{ "template": { "git_repo": "abc", "docker_repo": "def", "build_dir": "ghi" }, "services" : { "service1": {}, "service2" : {} } }')

        assert_equal(2, len(services))
        assert_equal("service2", services[0].name)
        assert_equal("abc", services[0].git_url)
        assert_equal("def", services[0].docker_repo)
        assert_equal("ghi", services[0].build_dir)

        assert_equal("service1", services[1].name)
        assert_equal("abc", services[1].git_url)
        assert_equal("def", services[1].docker_repo)
        assert_equal("ghi", services[1].build_dir)
Example #3
0
    def test_two(self):
        services = parse_config('{ "services": { ' +
          '"service1": { "git_repo": "abc", "docker_repo": "def", "build_dir": "ghi" }, ' +
          '"service2": { "git_repo": "123", "docker_repo": "456", "build_dir": "789" } ' +
        '} }')

        assert_equal(2, len(services))

        assert_equal("service1", services[1].name)
        assert_equal("abc", services[1].git_url)
        assert_equal("def", services[1].docker_repo)
        assert_equal("ghi", services[1].build_dir)

        assert_equal("service2", services[0].name)
        assert_equal("123", services[0].git_url)
        assert_equal("456", services[0].docker_repo)
        assert_equal("789", services[0].build_dir)
Example #4
0
    def test_template_override(self):
        services = parse_config('{ "template": { "git_repo": "abc", "docker_repo": "def", "build_dir": "ghi" }, "services" : { "service1": { "git_repo": "123" } } }')

        assert_equal(1, len(services))
        assert_equal("123", services[0].git_url)
Example #5
0
    def test_template_name_replacement(self):
        services = parse_config('{ "template": { "git_repo": "{name}.git", "docker_repo": "def", "build_dir": "ghi" }, "services" : { "service1": {} } }')

        assert_equal(1, len(services))
        assert_equal("service1", services[0].name)
        assert_equal("service1.git", services[0].git_url)
Example #6
0
 def test_env_replacement(self):
     os.environ['JUST_FOR_TESTING'] = 'TESTING'
     services = parse_config('{ "services": { "service1": { "git_repo": "abc", "docker_repo": "def", "build_dir": "$JUST_FOR_TESTING/foo" } } }')
     assert_equal(1, len(services))
     assert_equal("TESTING/foo", services[0].build_dir)
Example #7
0
 def test_empty(self):
     parse_config('{ "services": {} }')