def test_clean_input(self): # Test Bad Data with snappass.app.test_request_context("/", data={ 'password': '******', 'ttl': 'bar' }, method='POST'): self.assertRaises(BadRequest, snappass.clean_input) # No Password with snappass.app.test_request_context("/", method='POST'): self.assertRaises(BadRequest, snappass.clean_input) # No TTL with snappass.app.test_request_context("/", data={'password': '******'}, method='POST'): self.assertRaises(BadRequest, snappass.clean_input) with snappass.app.test_request_context("/", data={ 'password': '******', 'ttl': 'hour' }, method='POST'): self.assertEqual((3600, 'foo'), snappass.clean_input())
def test_clean_input(self): # Test Bad Data with snappass.app.test_request_context( "/", data={'password': '******', 'ttl': 'bar'}, method='POST'): self.assertRaises(ClientDisconnected, snappass.clean_input) # No Password with snappass.app.test_request_context( "/", method='POST'): self.assertRaises(ClientDisconnected, snappass.clean_input) # No TTL with snappass.app.test_request_context( "/", data={'password': '******'}, method='POST'): self.assertRaises(ClientDisconnected, snappass.clean_input) with snappass.app.test_request_context( "/", data={'password': '******', 'ttl': 'hour'}, method='POST'): self.assertEqual((3600, 'foo'), snappass.clean_input())