Пример #1
0
    def test_validate_alert_list_args_when_until_is_invalid(self):
        """Test case scenario when the argument named until is invalid."""
        from Flashpoint import validate_alert_list_args

        with pytest.raises(ValueError) as err:
            validate_alert_list_args({'until': 'abc'})
        assert str(err.value) == INVALID_DATE_MESSAGE
Пример #2
0
    def test_validate_alert_list_args_when_size_is_invalid(self):
        """Test case scenario when the argument named size is invalid."""
        from Flashpoint import validate_alert_list_args

        with pytest.raises(ValueError) as err:
            validate_alert_list_args({'size': '-1'})
        assert str(err.value) == MESSAGES['SIZE_ERROR'].format('-1')

        with pytest.raises(ValueError) as err:
            validate_alert_list_args({'size': '101'})
        assert str(err.value) == MESSAGES['SIZE_ERROR'].format('101')
Пример #3
0
    def test_validate_alert_list_args_when_valid_args_are_provided(self):
        """Test case scenario when the arguments provided are valid."""
        from Flashpoint import validate_alert_list_args

        args = {'size': '5', 'since': '03/07/2021', 'scroll_id': ''}

        fetch_args = {
            'size': 5,
            'since': '2021-03-07T00:00:00Z',
        }

        assert validate_alert_list_args(args) == fetch_args