546 |
546 |
|
547 |
547 |
resp = app.get('/test-self-invoice/')
|
548 |
548 |
resp = resp.form.submit().follow()
|
549 |
|
assert 'Sorry, no invoice were found with that number and amount.'
|
|
549 |
assert 'Sorry, the provided amount is invalid.' in resp
|
550 |
550 |
|
551 |
551 |
resp = app.get('/test-self-invoice/')
|
552 |
552 |
resp.form['invoice-number'] = 'F201601'
|
553 |
553 |
resp.form['invoice-amount'] = 'FOOBAR' # wrong format
|
554 |
554 |
resp = resp.form.submit().follow()
|
555 |
|
assert 'Sorry, the provided amount is invalid.'
|
|
555 |
assert 'Sorry, the provided amount is invalid.' in resp
|
556 |
556 |
|
|
557 |
mock_json = mock.Mock(status_code=404)
|
|
558 |
mock_get.return_value = mock_json
|
557 |
559 |
resp = app.get('/test-self-invoice/')
|
558 |
560 |
resp.form['invoice-number'] = 'F201602' # invalid number
|
559 |
561 |
resp.form['invoice-amount'] = '123.45'
|
560 |
562 |
resp = resp.form.submit().follow()
|
561 |
|
assert 'Sorry, no invoice were found with that number and amount.'
|
|
563 |
assert 'Sorry, no invoice were found with that number and amount.' in resp
|
562 |
564 |
|
|
565 |
mock_json = mock.Mock()
|
|
566 |
mock_json.json.return_value = {'err': 0, 'data': INVOICES[0]}
|
|
567 |
mock_get.return_value = mock_json
|
563 |
568 |
resp = app.get('/test-self-invoice/')
|
564 |
569 |
resp.form['invoice-number'] = 'F201601'
|
565 |
570 |
resp.form['invoice-amount'] = '123.46' # invalid amount
|
566 |
571 |
resp = resp.form.submit().follow()
|
567 |
|
assert 'Sorry, no invoice were found with that number and amount.'
|
|
572 |
assert 'Sorry, no invoice were found with that number and amount.' in resp
|
568 |
573 |
|
569 |
574 |
resp = app.get('/test-self-invoice/')
|
570 |
575 |
resp.form['invoice-number'] = 'F201601'
|
571 |
|
-
|