Example #1
0
    def _static_get(self, uri, body, content_type=None):
        response = application.get_response(uri)
        self.assertEqual(response.status_int, 404)

        self._create_static(uri=uri, body=body, content_type=content_type)
        response = application.get_response(uri)
        self.assertEqual(response.body, body)
        if content_type:
            self.assertEqual(response.content_type, content_type)
        else:
            self.assertEqual(response.content_type, 'text/plain')
        self.assertEqual(response.status_int, 200)
Example #2
0
  def _static_get(self, uri, body, content_type=None):
    response = application.get_response(uri)
    self.assertEqual(response.status_int, 404)

    self._create_static(uri=uri, body=body, content_type=content_type)
    response = application.get_response(uri)
    self.assertEqual(response.body, body)
    if content_type:
      self.assertEqual(response.content_type, content_type)
    else:
      self.assertEqual(response.content_type, 'text/plain')
    self.assertEqual(response.status_int, 200)
Example #3
0
    def test_config_get_fail(self):
        # nothing at root
        response = application.get_response('/config')
        self.assertEqual(response.status_int, 404)

        # basic auth fail
        response = application.get_response(self.uri_config)
        self.assertEqual(response.status_int, 401)

        # basic auth success, but domain doesn't exist yet
        request = Request.blank(self.uri_config, headers=[self.auth_header])
        response = request.get_response(application)
        self.assertEqual(response.status_int, 404)
Example #4
0
  def test_config_get_fail(self):
    # nothing at root
    response = application.get_response('/config')
    self.assertEqual(response.status_int, 404)

    # basic auth fail
    response = application.get_response(self.uri_config)
    self.assertEqual(response.status_int, 401)

    # basic auth success, but domain doesn't exist yet
    request = Request.blank(self.uri_config, headers=[self.auth_header])
    response = request.get_response(application)
    self.assertEqual(response.status_int, 404)
Example #5
0
 def test_c_get(self):
     # no GET for /c
     response = application.get_response('/c')
     self.assertEqual(response.status_int, 405)
Example #6
0
 def test_index(self):
     response = application.get_response('/')
     self.assertEqual(response.status_int, 200)
     self.assertEqual('banner.min.js' in response.text, True)
Example #7
0
 def test_index(self):
   response = application.get_response('/')
   self.assertEqual(response.status_int, 200)
   self.assertEqual('banner.min.js' in response.text, True)
Example #8
0
 def test_c_get(self):
   # no GET for /c
   response = application.get_response('/c')
   self.assertEqual(response.status_int, 405)