예제 #1
0
from delfick_app import command_output
from option_merge import MergedOptions
from textwrap import dedent
from getpass import getpass
import mock
import json
import os

describe HarpoonCase, "Collector":
    describe "clone":
        it "has a new harpoon object":
            configuration = {"images": {"blah": {"commands": "FROM ubuntu:14.04"}}}
            with self.a_temp_file(json.dumps(configuration)) as filename:
                collector = Collector()
                collector.prepare(filename, {"harpoon": {"chosen_image": "blah"}, "bash": None, "command": None, "assume_role": None})
                collector2 = collector.clone({"harpoon": {"chosen_image": "other"}})

                self.assertNotEqual(collector.configuration["harpoon"], collector2.configuration["harpoon"])
                self.assertEqual(collector.configuration["harpoon"].chosen_image, "blah")
                self.assertEqual(collector2.configuration["harpoon"].chosen_image, "other")

    describe "prepare":
        it "adds some items to the configuration from the args_dict":
            bash = "bash command"
            extra = "extra commands after the --"
            command = "Command command"
            args_dict = {"harpoon": {}}

            configuration = {"images": {"blah": {"commands": "FROM ubuntu:14.04"}}}
            with self.a_temp_file(json.dumps(configuration)) as filename:
                collector = Collector()
예제 #2
0
from delfick_app import command_output
from option_merge import MergedOptions
from textwrap import dedent
from getpass import getpass
import mock
import json
import os

describe HarpoonCase, "Collector":
    describe "clone":
        it "has a new harpoon object":
            configuration = {"images": {"blah": {"commands": "FROM ubuntu:14.04"}}}
            with self.a_temp_file(json.dumps(configuration)) as filename:
                collector = Collector()
                collector.prepare(filename, {"harpoon": {"chosen_image": "blah"}, "bash": None, "command": None, "assume_role": None})
                collector2 = collector.clone({"harpoon": {"chosen_image": "other"}})

                self.assertNotEqual(collector.configuration["harpoon"], collector2.configuration["harpoon"])
                self.assertEqual(collector.configuration["harpoon"].chosen_image, "blah")
                self.assertEqual(collector2.configuration["harpoon"].chosen_image, "other")

    describe "prepare":
        it "adds some items to the configuration from the args_dict":
            bash = "bash command"
            extra = "extra commands after the --"
            command = "Command command"
            args_dict = {"harpoon": {}}

            configuration = {"images": {"blah": {"commands": "FROM ubuntu:14.04"}}}
            with self.a_temp_file(json.dumps(configuration)) as filename:
                collector = Collector()
예제 #3
0
from delfick_app import command_output
from option_merge import MergedOptions
from textwrap import dedent
from getpass import getpass
import mock
import json
import os

describe HarpoonCase, "Collector":
    describe "clone":
        it "has a new harpoon object":
            configuration = {"harpoon": {"chosen_image": "blah"}, "images": {"blah": {"commands": "FROM ubuntu:14.04"}}}
            with self.a_temp_file(json.dumps(configuration)) as filename:
                collector = Collector()
                collector.prepare(filename, {"harpoon": {}, "bash": None, "command": None})
                collector2 = collector.clone({"chosen_image": "other"})

                self.assertNotEqual(collector.configuration["harpoon"], collector2.configuration["harpoon"])
                self.assertEqual(collector.configuration["harpoon"].chosen_image, "blah")
                self.assertEqual(collector2.configuration["harpoon"].chosen_image, "other")

    describe "prepare":
        it "complains if there is no images":
            configuration = {}
            with self.a_temp_file(json.dumps(configuration)) as filename:
                with self.fuzzyAssertRaisesError(Collector.BadConfigurationErrorKls, "Didn't find any images in the configuration"):
                    Collector().prepare(filename, {})

        it "adds some items to the configuration from the cli_args":
            bash = "bash command"
            extra = "extra commands after the --"