示例#1
0
    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)
示例#2
0
    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())
示例#3
0
    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)
示例#4
0
    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)
示例#5
0
    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)
示例#6
0
    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)
示例#7
0
    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)