def test_cse_empty_avro(self):
		"""Send a POST with a schema-complete empty request."""
		from views import index_view
		request = testing.DummyRequest(post={}, content_type='avro/binary')
		request.content_length = getsize('tests/empty.avro')
		with open('tests/empty.avro', 'rb') as request.body_file_seekable:
			result = index_view(request)
		self.assertEqual(result.status_int, 200, result.status_int)
def application(headers, start_response):
    response = None
    PATH_INFO = headers.get("PATH_INFO")
    if PATH_INFO == "/":
        response = index_view()
    if PATH_INFO == "/about":
        response = about_view()
    if response is None:
        start_response("404 NOT_FOUND", [("Content-Type", "text/plain")])
        return [b"NOT_FOUND"]
    start_response("200 OK", [("Content-Type", "text/plain")])
    return [response.encode()]
Beispiel #3
0
 def test_index_view(self):
     from views import index_view
     result = index_view({})
     self.assertEqual(len(result.keys()), 0)
    def test_hello_view(self):
        from views import index_view

        result = index_view({})
        self.assertEqual(result['page_title'], 'Home')
	def test_cse_empty_body(self):
		"""Send a POST with an empty request body."""
		from views import index_view
		request = testing.DummyRequest(post={}, content_type='avro/binary')
		result = index_view(request)
		self.assertEqual(result.status_int, 400, result.status_int)
	def test_cse_bad_contenttype(self):
		"""Send an unsupported http content-type header."""
		from views import index_view
		request = testing.DummyRequest(post={}, content_type='text/javascript')
		result = index_view(request)
		self.assertEqual(result.status_int, 406, result.status_int)
	def test_cse_bad_method(self):
		"""Send an unsupported http method."""
		from views import index_view
		request = testing.DummyRequest()
		result = index_view(request)
		self.assertEqual(result.status_int, 405, result.status_int)
Beispiel #8
0
    def test_hello_view(self):
        from views import index_view

        result = index_view({})
        self.assertEqual(result['page_title'], 'Home')