def test_creates_client_cert_required_response(self): response_object1 = ResponseFactory.create('url', '60', meta='', raw_body=b'') response_object2 = ResponseFactory.create('url', '61', meta='', raw_body=b'') self.assertIsInstance(response_object1, ClientCertRequiredResponse) self.assertIsInstance(response_object2, ClientCertRequiredResponse)
def test_creates_temp_failure_response(self): response_object1 = ResponseFactory.create('url', '40', meta='', raw_body=b'') response_object2 = ResponseFactory.create('url', '44', meta='', raw_body=b'') self.assertIsInstance(response_object1, TempFailureResponse) self.assertIsInstance(response_object2, TempFailureResponse)
def test_creates_perm_failure_response(self): response_object1 = ResponseFactory.create('url', '50', meta='', raw_body=b'') response_object2 = ResponseFactory.create('url', '57', meta='', raw_body=b'') self.assertIsInstance(response_object1, PermFailureResponse) self.assertIsInstance(response_object2, PermFailureResponse)
def test_creates_input_response(self): response_object1 = ResponseFactory.create('url', '10', meta='Some input', raw_body=b'') response_object2 = ResponseFactory.create('url', '11', meta='', raw_body=b'') self.assertIsInstance(response_object1, InputResponse) self.assertIsInstance(response_object2, InputResponse)
def test_creates_redirect_response(self): response_object1 = ResponseFactory.create('url', '30', meta='', raw_body=b'') response_object2 = ResponseFactory.create('url', '31', meta='', raw_body=b'') self.assertIsInstance(response_object1, RedirectResponse) self.assertIsInstance(response_object2, RedirectResponse)
def setUp(self): self.response = ResponseFactory.create( 'gemini://test.com/', RESPONSE_STATUSDETAIL_TEMP_FAILURE, meta= 'The server had trouble processing your response. Please try again.' )
def setUp(self): self.response = ResponseFactory.create( 'gemini://test.com/', RESPONSE_STATUSDETAIL_CLIENTCERT_REQUIRED, meta='Please create a client certificate for this request.', certificate='dummy cert object', )
def setUp(self): self.response = ResponseFactory.create( 'gemini://test.com/', RESPONSE_STATUSDETAIL_PERM_FAILURE, meta='There was a permanent error on this page.', certificate='dummy cert object', )
def setUp(self): self.response = ResponseFactory.create( 'gemini://test.com/', RESPONSE_STATUSDETAIL_REDIRECT_TEMPORARY, meta='gemini://test-new.com/', certificate='dummy cert object', )
def setUp(self): self.response = ResponseFactory.create( 'gemini://test.com/', RESPONSE_STATUSDETAIL_INPUT, meta='Enter a username', certificate='dummy cert object', )
def setUp(self): self.response = ResponseFactory.create( 'gemini://test.com/', RESPONSE_STATUSDETAIL_SUCCESS, meta='text/gemini; charset=utf-8', raw_body=b"This is a sample body\r\n\r\nHello", certificate='dummy cert object', )
def test_creates_error_response(self): response_object1 = ResponseFactory.create('url', '01', meta='', raw_body=b'') response_object2 = ResponseFactory.create('url', '08', meta='', raw_body=b'') response_object3 = ResponseFactory.create('url', '99', meta='', raw_body=b'') response_object4 = ResponseFactory.create('url', 'ab', meta='', raw_body=b'') self.assertIsInstance(response_object1, ErrorResponse) self.assertIsInstance(response_object2, ErrorResponse) self.assertIsInstance(response_object3, ErrorResponse) self.assertIsInstance(response_object4, ErrorResponse)
def test_creates_success_response(self): response_object = ResponseFactory.create('url', '20', meta='text/gemini', raw_body=b'Some body') self.assertIsInstance(response_object, SuccessResponse)
def setUp(self): self.response = ResponseFactory.create('gemini://test.com/', '99', meta='THIS IS A BAD RESPONSE')
def setUp(self): self.response = ResponseFactory.create( 'gemini://test.com/', RESPONSE_STATUSDETAIL_ERROR_DNS, meta='Could not find a host at test.com.')
def setUp(self): self.response = ResponseFactory.create('gemini://test.com/', RESPONSE_STATUSDETAIL_INPUT, meta='Enter a username')