예제 #1
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_error_response_builder_408(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        json_response = alive.build_error_response('http://foo', 'ERROR!')

        self.assertEquals(json_response['status_code'], 408)
        self.assertEquals(json_response['status_family_type'], 'Client error')
        self.assertEquals(json_response['status_message'], 'ERROR')
        self.assertEquals(json_response['url'], 'http://foo')
        self.assertEquals(json_response['error'], 'ERROR!')
예제 #2
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_error_response_builder_408(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        json_response = alive.build_error_response('http://foo', 'ERROR!')

        self.assertEquals(json_response['status_code'], 408)
        self.assertEquals(json_response['status_family_type'], 'Client error')
        self.assertEquals(json_response['status_message'], 'ERROR')
        self.assertEquals(json_response['url'], 'http://foo')
        self.assertEquals(json_response['error'], 'ERROR!')
예제 #3
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_response_builder_500(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        r = self.mock_response_object(500, 'doo')
        json_response = alive.build_json_response(r, 'http://foo')

        self.assertEquals(json_response['status_code'], 500)
        self.assertEquals(json_response['status_family_type'], 'Server error')
        self.assertEquals(json_response['status_message'], 'doo')
        self.assertEquals(json_response['url'], 'http://foo')
예제 #4
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_response_builder_500(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        r = self.mock_response_object(500, 'doo')
        json_response = alive.build_json_response(r, 'http://foo')

        self.assertEquals(json_response['status_code'], 500)
        self.assertEquals(json_response['status_family_type'], 'Server error')
        self.assertEquals(json_response['status_message'], 'doo')
        self.assertEquals(json_response['url'], 'http://foo')
예제 #5
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_response_builder_400(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        r = self.mock_response_object(404, 'moo')
        json_response = alive.build_json_response(r, 'http://notfound')

        self.assertEquals(json_response['status_code'], 404)
        self.assertEquals(json_response['status_family_type'], 'Client error')
        self.assertEquals(json_response['status_message'], 'moo')
        self.assertEquals(json_response['url'], 'http://notfound')
        self.assertEquals(json_response['redirect_url'], '')
예제 #6
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_response_builder_400(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        r = self.mock_response_object(404, 'moo')
        json_response = alive.build_json_response(r, 'http://notfound')

        self.assertEquals(json_response['status_code'], 404)
        self.assertEquals(json_response['status_family_type'], 'Client error')
        self.assertEquals(json_response['status_message'], 'moo')
        self.assertEquals(json_response['url'], 'http://notfound')
        self.assertEquals(json_response['redirect_url'], '')
예제 #7
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_response_builder_300_moved(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        r = self.mock_response_object(301, 'baz')
        json_response = alive.build_json_response(r, 'http://moved')

        self.assertEquals(json_response['status_code'], 301)
        self.assertEquals(json_response['status_family_type'], 'Redirected message')
        self.assertEquals(json_response['status_message'], 'baz')
        self.assertEquals(json_response['url'], 'http://moved')
        self.assertEquals(json_response['redirect_url'], '')
예제 #8
0
파일: test_alive.py 프로젝트: b-cube/alive
    def test_response_builder_300_moved(self):
        alive = Alive(None)  # we don't need an sparql endpoint
        r = self.mock_response_object(301, 'baz')
        json_response = alive.build_json_response(r, 'http://moved')

        self.assertEquals(json_response['status_code'], 301)
        self.assertEquals(json_response['status_family_type'],
                          'Redirected message')
        self.assertEquals(json_response['status_message'], 'baz')
        self.assertEquals(json_response['url'], 'http://moved')
        self.assertEquals(json_response['redirect_url'], '')