Example #1
0
    def test_gets_environment(self):
        envs = [ self.__env("vagrant") ]
        config = Mock()
        config.get_environments = Mock(return_value=envs) 

        envs = Environments(config)

        self.assertTrue(envs.get("vagrant") is not None)
Example #2
0
    def test_lists_environments(self):
        envs = [ self.__env("vagrant") ]

        config = Mock()
        config.get_environments = Mock(return_value=envs)
        config.get_deploy_log = Mock()

        envs = Environments(config)

        self.assertEquals(1, len(envs.list()))
Example #3
0
    def test_sets_environment_on_deploy(self):
        envs = [ self.__env("production") ]
        config = Mock()
        config.get_environments = Mock(return_value=envs)
        config.set_environment = Mock()

        envs = Environments(config)
        env = envs.list()[0]
        env.deploy = Mock()

        envs.deploy("production", "EXAMPLE-PLAN", "EXAMPLE-PLAN-56")
        config.set_environment.assert_called_with("production")
Example #4
0
    def test_deploys_to_environments(self):
        envs = [ self.__env("vagrant") ]
        config = Mock()
        config.get_environments = Mock(return_value=envs)

        envs = Environments(config)
        env = envs.list()[0]
        env.deploy = Mock()

        envs.deploy("vagrant", "EXAMPLE-PLAN", "EXAMPLE-PLAN-56")

        env.deploy.assert_called_with("EXAMPLE-PLAN", "EXAMPLE-PLAN-56")