Beispiel #1
0
class SITLoaderTest(unittest.TestCase):
    def setUp(self):
        self.session = Session(region_name='us-west-1')
        self.configs_directory = 'tests/sit/configs'
        self.sit_loader = SITLoader(session=self.session,
                                    configs_directory=self.configs_directory)
        self.mock_cf_helper_true_responses()

    def mock_cf_helper_true_responses(self):
        cf_helper = CFHelper(configs_directory=self.configs_directory,
                             session=self.session)
        cf_helper.get_stack_info = MagicMock(return_value=False)
        cf_helper.validate_template = MagicMock(return_value=True)
        cf_helper.create_or_update_stack = MagicMock(return_value=True)
        cf_helper.create_stack = MagicMock(return_value=True)
        cf_helper.stack_was_created_successfully = MagicMock(return_value=True)
        self.sit_loader.cf_helper = cf_helper

    def test_successful_run(self):
        self.sit_loader.run()

    @raises(SystemExit)
    def test_failed_run(self):
        self.sit_loader.cf_helper.stack_was_created_successfully = MagicMock(
            return_value=False)
        self.assertRaises(self.sit_loader.stack_created_successfully(),
                          Exception)
    def setUp(self):
        session = Session(region_name='us-west-1')
        current_dir = os.path.dirname(os.path.realpath(__file__))
        test_dir = '{0}/test_data'.format(current_dir)
        pill = placebo.attach(session, test_dir)
        pill.playback()

        self.configs_directory = 'tests/sit/configs'
        self.cf_helper_placebo = CFHelper(
            configs_directory=self.configs_directory, session=session)
        self.sit_loader_placebo = SITLoader(
            configs_directory=self.configs_directory, session=session)
class SITLoaderTest(unittest.TestCase):

    def setUp(self):
        self.session = Session(region_name='us-west-1')
        self.configs_directory = 'tests/sit/configs'
        self.sit_loader = SITLoader(session=self.session, configs_directory=self.configs_directory)
        self.mock_cf_helper_true_responses()

    def mock_cf_helper_true_responses(self):
        cf_helper = CFHelper(configs_directory=self.configs_directory, session=self.session)
        cf_helper.get_stack_info = MagicMock(return_value=False)
        cf_helper.validate_template = MagicMock(return_value=True)
        cf_helper.create_or_update_stack = MagicMock(return_value=True)
        cf_helper.create_stack = MagicMock(return_value=True)
        cf_helper.stack_was_created_successfully = MagicMock(return_value=True)
        self.sit_loader.cf_helper = cf_helper

    def test_successful_run(self):
        self.sit_loader.run()

    @raises(SystemExit)
    def test_failed_run(self):
        self.sit_loader.cf_helper.stack_was_created_successfully = MagicMock(return_value=False)
        self.assertRaises(self.sit_loader.stack_created_successfully(), Exception)
 def run(self):
     install.run(self)
     Log.setup()
     SITTemplateHelper().validate()
     SITLoader().run()
Beispiel #5
0
 def setUp(self):
     self.session = Session(region_name='us-west-1')
     self.configs_directory = 'tests/sit/configs'
     self.sit_loader = SITLoader(session=self.session,
                                 configs_directory=self.configs_directory)
     self.mock_cf_helper_true_responses()
 def setUp(self):
     self.session = Session(region_name='us-west-1')
     self.configs_directory = 'tests/sit/configs'
     self.sit_loader = SITLoader(session=self.session, configs_directory=self.configs_directory)
     self.mock_cf_helper_true_responses()