def test_should_get_connection_params_false(self, is_help_message_requested_mock, is_config_mode_mock): # arrange 1 input_parser = Mock() is_help_message_requested_mock.return_value = True is_config_mode_mock.return_value = True # act 1 result = BootstrapHelper.should_get_connection_params(input_parser) # assert 1 self.assertFalse(result) # arrange 2 is_help_message_requested_mock.return_value = False # act 2 result = BootstrapHelper.should_get_connection_params(input_parser) # assert 2 self.assertFalse(result) # arrange 3 is_help_message_requested_mock.return_value = True is_config_mode_mock.return_value = False # act 3 result = BootstrapHelper.should_get_connection_params(input_parser) # assert 3 self.assertFalse(result)
def test_validate_command(self): # arrange expected_commands = ["bp", "blueprint", "sb", "sandbox", "configure"] # act - make sure all expected commands are valid for command in expected_commands: BootstrapHelper.validate_command(command) with self.assertRaises(DocoptExit): BootstrapHelper.validate_command(Mock())
def test_is_config_mode_false(self): # arrange input_parser = Mock(command="blueprint") # act result = BootstrapHelper.is_config_mode(input_parser) # assert self.assertFalse(result)
def test_is_config_mode_true(self): # arrange input_parser = Mock(command="configure") # act result = BootstrapHelper.is_config_mode(input_parser) # assert self.assertTrue(result)
def test_get_connection_params_no_need_for_connection( self, should_get_connection_params_mock): # arrange input_parser = Mock() should_get_connection_params_mock.return_value = False # act conn = BootstrapHelper.get_connection_params(input_parser) # assert self.assertIsNone(conn)
def test_get_connection_params_returns_connection( self, should_get_connection_params_mock, connection_provider_class_mock): # arrange input_parser = Mock() # act conn = BootstrapHelper.get_connection_params(input_parser) # assert self.assertEqual( conn, connection_provider_class_mock.return_value.get_connection. return_value)
def test_should_get_connection_params_true(self, is_help_message_requested_mock, is_config_mode_mock): # arrange input_parser = Mock() is_help_message_requested_mock.return_value = False is_config_mode_mock.return_value = False # act result = BootstrapHelper.should_get_connection_params(input_parser) # assert self.assertTrue(result)