def test_validate_headers_pass(self):
     request = RequestClient(mock_data.apigateway_event())
     response = ResponseClient()
     validator = RequestValidator(request, response)
     validator._required_fields(['test-key'], {'test-key': '123456'},
                                'headers')
     self.assertFalse(response.has_errors)
 def test_validate_path_params_pass(self):
     request = RequestClient(mock_data.apigateway_event())
     response = ResponseClient()
     validator = RequestValidator(request, response)
     validator._required_fields(['test_path'], {'test_path': 'test_value'},
                                'path parameters')
     self.assertFalse(response.has_errors)
 def test_with_validation_require_headers_fail(self):
     response = handle_validation_required_headers_fail(
         mock_data.apigateway_event(), None)
     self.assertEqual(response['statusCode'], 400)
 def test_with_validation_require_headers(self):
     response = handle_validation_required_headers(
         mock_data.apigateway_event(), None)
     self.assertEqual(response['statusCode'], 200)
     self.assertEqual(response['body'], "Hello")
 def test_no_authorization(self):
     response = handle_no_validation(mock_data.apigateway_event(), None)
     self.assertEqual(response['statusCode'], 200)
     self.assertEqual(response['body'], "Hello")
Exemple #6
0
 def setUp(self):
     self.RequestClient = RequestClient(mock_data.apigateway_event())