Skip to content

Commit

Permalink
tests for user input missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mislav Cimperšak committed Nov 20, 2017
1 parent 1d5fbde commit 94d19ac
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ def test_get_excuse_image__success():
assert data.size == (413, 360)


def test_get_excuse_image__who_missing():
ERROR_CODE = 1010
data = get_excuse_image('', 'a', 'a')
assert data[0]['code'] == ERROR_CODE


def test_get_excuse_image__why_missing():
ERROR_CODE = 1020
data = get_excuse_image('a', '', 'a')
assert data[0]['code'] == ERROR_CODE


def test_get_excuse_image__what_missing():
ERROR_CODE = 1030
data = get_excuse_image('a', 'a', '')
assert data[0]['code'] == ERROR_CODE


def test_get_excuse_image__who_too_long():
ERROR_CODE = 1011
data = get_excuse_image('programmerprogrammerprogrammer', 'a', 'a')
Expand All @@ -92,6 +110,23 @@ def test_get_excuse_image__what_too_long():
assert data[0]['code'] == ERROR_CODE


def test_get_excuse_image__who_too_long__why_missing():
ERROR_CODE_WHO_TOO_LONG = 1011
ERROR_CODE_WHY_MISSING = 1020
data = get_excuse_image('programmerprogrammerprogrammer', '', 'a')
assert set([error['code'] for error in data]) == \
set([ERROR_CODE_WHO_TOO_LONG, ERROR_CODE_WHY_MISSING])


def test_get_excuse_image__who_missing__why_missing__what_too_long():
ERROR_CODE_WHO_MISSING = 1010
ERROR_CODE_WHY_MISSING = 1020
ERROR_CODE_WHAT_TOO_LONG = 1031
data = get_excuse_image('', '', 'compilingcompilingcompiling')
assert set([error['code'] for error in data]) == \
set([ERROR_CODE_WHO_MISSING, ERROR_CODE_WHY_MISSING, ERROR_CODE_WHAT_TOO_LONG])


def test_get_text_font():
font = _get_text_font(20)
assert font.size == 20
Expand Down

0 comments on commit 94d19ac

Please sign in to comment.