def test_deploy_binaries_and_conf_deploys_both_conf_and_binary_for_remote_host(self): mock_DeployTarget = self.patch('app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'remote_host', 'username', 'exec', '/path/to/exec', '/path/to/conf') self.assertTrue(mock_DeployTarget_instance.deploy_binary.called) self.assertTrue(mock_DeployTarget_instance.deploy_conf.called)
def test_deploy_binaries_and_conf_deploys_both_conf_and_binary_for_remote_host(self): mock_DeployTarget = self.patch('app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'remote_host', 'username', 'exec', '/path/to/exec', '/path/to/conf') self.assertTrue(mock_DeployTarget_instance.deploy_binary.called) self.assertTrue(mock_DeployTarget_instance.deploy_conf.called)
def test_deploy_binaries_and_conf_doesnt_deploy_conf_if_localhost_with_same_in_use_conf(self): self.patch('os.path.expanduser').return_value = '/home' mock_DeployTarget = self.patch('app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'localhost', 'username', 'exec', '/path/to/exec', '/home/.clusterrunner/clusterrunner.conf') self.assertFalse(mock_DeployTarget_instance.deploy_conf.called)
def test_deploy_binaries_and_conf_doesnt_deploy_binaries_if_localhost_and_same_executable_path_in_use( self): self.patch('os.path.expanduser').return_value = '/home' mock_DeployTarget = self.patch( 'app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'localhost', 'username', '/home/.clusterrunner/dist/clusterrunner', '/home/.clusterrunner/clusterrunner.tgz', '/clusterrunner.conf') self.assertFalse(mock_DeployTarget_instance.deploy_binary.called)
def test_deploy_binaries_and_conf_deploys_conf_if_localhost_with_diff_in_use_conf( self): self.patch('os.path.expanduser').return_value = '/home' mock_DeployTarget = self.patch( 'app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'localhost', 'username', 'exec', '/path/to/exec', '/home/.clusterrunner/clusterrunner_prime.conf') self.assertTrue(mock_DeployTarget_instance.deploy_conf.called)
def test_deploy_binaries_and_conf_deploys_binaries_if_localhost_and_different_executable_path_in_use(self): self.patch('os.path.expanduser').return_value = '/home' mock_DeployTarget = self.patch('app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'localhost', 'username', '/home/.clusterrunner/dist/clusterrunner_rime', '/home/.clusterrunner/clusterrunner.tgz', '/clusterrunner.conf' ) self.assertTrue(mock_DeployTarget_instance.deploy_binary.called)
def test_deploy_binaries_and_conf_behaves_properly_if_conf_or_binary_is_in_use_on_localhost( self, current_executable, in_use_conf_path, expect_deploy_conf, expect_deploy_binary, ): mock_DeployTarget = self.patch('app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'localhost', 'username', current_executable, join(expanduser('~'), '.clusterrunner', 'clusterrunner.tgz'), in_use_conf_path ) self.assertEqual(expect_deploy_binary, mock_DeployTarget_instance.deploy_binary.called) self.assertEqual(expect_deploy_conf, mock_DeployTarget_instance.deploy_conf.called)
def test_deploy_binaries_and_conf_behaves_properly_if_conf_or_binary_is_in_use_on_localhost( self, current_executable, in_use_conf_path, expect_deploy_conf, expect_deploy_binary, ): mock_DeployTarget = self.patch('app.subcommands.deploy_subcommand.DeployTarget') mock_DeployTarget_instance = mock_DeployTarget.return_value deploy_subcommand = DeploySubcommand() deploy_subcommand._deploy_binaries_and_conf( 'localhost', 'username', current_executable, join(expanduser('~'), '.clusterrunner', 'clusterrunner.tgz'), in_use_conf_path ) self.assertEqual(expect_deploy_binary, mock_DeployTarget_instance.deploy_binary.called) self.assertEqual(expect_deploy_conf, mock_DeployTarget_instance.deploy_conf.called)