Example #1
0
def test_event_params_invalid_rem_fields():
    """
    When end_date is invalid then through value error.
    """
    from AgariPhishingDefense import get_events_params

    args = {'rem_fields': 'id,created_at'}
    with pytest.raises(ValueError) as e:
        get_events_params(args=args)

    assert str(e.value) == 'Cannot pass "id" in rem_fields argument.'
Example #2
0
def test_event_params_invalid_page_id():
    """
    When page_id is negative then through value error.
    """
    from AgariPhishingDefense import get_events_params

    args = {'page_id': '-1', 'limit': '50'}
    with pytest.raises(ValueError) as e:
        get_events_params(args=args, max_record=200)

    assert str(e.value) == 'Argument page_id must be a positive integer.'
Example #3
0
def test_event_params_invalid_end_date():
    """
    When end_date is invalid then through value error.
    """
    from AgariPhishingDefense import get_events_params

    args = {'end_date': 'end_date'}
    with pytest.raises(ValueError) as e:
        get_events_params(args=args)

    assert str(e.value) == 'The given value for end_date argument is invalid.'
Example #4
0
def test_event_params_invalid_limit():
    """
    When limit is negative or greater than 200 then through value error.
    """
    from AgariPhishingDefense import get_events_params

    args = {'limit': '2as'}
    with pytest.raises(ValueError) as e:
        get_events_params(args=args, max_record=200)

    assert (str(e.value) ==
            'Argument limit must be a positive integer between 1 to 200.')