Fix tests

This commit is contained in:
Nicholas Charriere 2016-07-18 13:36:06 -07:00
parent d88cf2600e
commit a9fc727240

View file

@ -1,7 +1,7 @@
import unittest import unittest
from unittest import TestCase from unittest import TestCase
from werkzeug.exceptions import ClientDisconnected from werkzeug.exceptions import BadRequest
# noinspection PyPep8Naming # noinspection PyPep8Naming
import snappass.main as snappass import snappass.main as snappass
@ -27,17 +27,17 @@ class SnapPassTestCase(TestCase):
# Test Bad Data # Test Bad Data
with snappass.app.test_request_context( with snappass.app.test_request_context(
"/", data={'password': 'foo', 'ttl': 'bar'}, method='POST'): "/", data={'password': 'foo', 'ttl': 'bar'}, method='POST'):
self.assertRaises(ClientDisconnected, snappass.clean_input) self.assertRaises(BadRequest, snappass.clean_input)
# No Password # No Password
with snappass.app.test_request_context( with snappass.app.test_request_context(
"/", method='POST'): "/", method='POST'):
self.assertRaises(ClientDisconnected, snappass.clean_input) self.assertRaises(BadRequest, snappass.clean_input)
# No TTL # No TTL
with snappass.app.test_request_context( with snappass.app.test_request_context(
"/", data={'password': 'foo'}, method='POST'): "/", data={'password': 'foo'}, method='POST'):
self.assertRaises(ClientDisconnected, snappass.clean_input) self.assertRaises(BadRequest, snappass.clean_input)
with snappass.app.test_request_context( with snappass.app.test_request_context(
"/", data={'password': 'foo', 'ttl': 'hour'}, method='POST'): "/", data={'password': 'foo', 'ttl': 'hour'}, method='POST'):