Skip to content

Commit

Permalink
Strengthen tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdabtieu committed Mar 5, 2023
1 parent 3de85ac commit 982fad7
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/tests/test_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,38 @@ def test_problem(client, database):
assert b'edited' in result.data

result = client.post('/problem/helloworldtesting/edit', data={
'name': 'hello world 2',
'description': 'a short fun problem 2',
'hints': 'try looking at the title 2',
'point_value': 2,
'rejudge': True,
'category': 'web',
'flag': 'ctf{hello}'
})
assert result.status_code == 400
assert b'required' in result.data

result = client.post('/problem/helloworldtesting/edit', data={
'name': 'hello world 2',
'description': 'a short fun problem 2',
'hints': 'try looking at the title 2',
'point_value': 2,
'rejudge': True,
'category': 'web',
'flag': '\x2f\x10'
})
assert result.status_code == 400
assert b'Invalid' in result.data

result = client.post('/problem/helloworldtesting/edit', data={
'name': 'hello world 2',
'description': 'a short fun problem 2',
'hints': 'try looking at the title 2',
'point_value': 2,
'rejudge': True,
'category': 'web',
'flag': 'ctf{hello}'
}, follow_redirects=True)
assert result.status_code == 200

result = client.get('/users/admin/profile')
assert result.status_code == 200
Expand Down

0 comments on commit 982fad7

Please sign in to comment.