def test_cupping_scores_required():
    c = CuppingModel({
        'name': 'Tester',
        'session_id': 10,
        'overall_score': '100',
    })
    with pytest.raises(DataError) as e:
        c.validate()

    errors = prettify_schematics_errors(e)
    assert errors == {'scores': 'This field is required.'}
def test_cupping_name_max_length():
    c = CuppingModel({
        'name': 'a' * 129,
        'session_id': 10,
        'overall_score': '100',
        'scores': {
            'Aroma': 12,
        },
    })
    with pytest.raises(DataError) as e:
        c.validate()

    errors = prettify_schematics_errors(e)
    assert errors == {'name': 'String value is too long.'}
def test_cupping_overall_score_max_value():
    c = CuppingModel({
        'name': 'Tester',
        'session_id': 10,
        'scores': {
            'aroma': 5
        },
        'overall_score': '100.1',
    })
    with pytest.raises(DataError) as e:
        c.validate()

    errors = prettify_schematics_errors(e)
    assert errors == {
        'overallScore': 'Value should be less than or equal to 100.'
    }