Example #1
0
def test_validate_item_values_value_is_non_int():
    payload = {
        'external_id': 'abc',
        'value': 'five'
    }
    with pytest.raises(falcon.HTTPBadRequest):
        validate_item_values(payload)
Example #2
0
def test_validate_item_values_name_is_non_ascii():
    payload = {
        'external_id': 'abc',
        'name': u'śćżźół'
    }
    with pytest.raises(falcon.HTTPBadRequest):
        validate_item_values(payload)
Example #3
0
def test_validate_item_values_value_is_int_conv_from_float():
    payload = {
        'external_id': 'abc',
        'value': 5.00000001
    }
    result = validate_item_values(payload)
    assert type(result) == dict
Example #4
0
def test_validate_item_values_value_is_int():
    payload = {
        'external_id': 'abc',
        'value': 5
    }
    result = validate_item_values(payload)
    assert type(result) == dict
Example #5
0
def test_validate_item_values_name_is_ascii():
    payload = {
        'external_id': 'abc',
        'name': 'some_name'
    }
    result = validate_item_values(payload)
    assert type(result) == dict
Example #6
0
def test_validate_item_values_no_ext_id():
    payload = {
        'value': 7
    }
    with pytest.raises(falcon.HTTPBadRequest):
        validate_item_values(payload)