Exemplo n.º 1
0
  def testGETInvalidSection(self):
    """
    Test for GET for '/_settings/section, List Some invalid Settings
    resoponse is validated for appropriate headers and body
    """
    response = self.app.get("/dddd", headers=self.headers)

    assertions.assertResponseHeaders(self, response)
    assertions.assertResponseBody(self, response)
    assertions.assertResponseStatusCode(self, response, 200)
    self.assertEqual(app_utils.jsonDecode(response.body), {})
Exemplo n.º 2
0
  def testGETValidSection(self):
    """
    Test for GET for '/_settings/section, List Some Settings
    resoponse is validated for appropriate headers and body
    """
    response = self.app.get("/aws", headers=self.headers)

    assertions.assertResponseHeaders(self, response)
    assertions.assertResponseBody(self, response)
    assertions.assertResponseStatusCode(self, response, 200)

    result = app_utils.jsonDecode(response.body)
    self.assertIsInstance(result, dict)
    for key in set(self.configurable_options["aws"]):
      if key in settings_api.HIDDEN_SETTINGS["aws"]:
        self.assertNotIn(key, result)
      else:
        self.assertIn(key, result)
Exemplo n.º 3
0
  def testSettingsHandlerDefault(self):
    """
    Test for GET for '/_settings', List All Settings
    resoponse is validated for appropriate headers and body
    """
    response = self.app.get("", headers=self.headers)

    assertions.assertResponseHeaders(self, response)
    assertions.assertResponseBody(self, response)
    assertions.assertResponseStatusCode(self, response, 200)

    result = app_utils.jsonDecode(response.body)
    self.assertIsInstance(result, dict)
    for config in self.configurable_options:
      self.assertTrue(result.has_key(config))
      for key in self.configurable_options[config]:
        if key in settings_api.HIDDEN_SETTINGS[config]:
          self.assertNotIn(key, result[config])
        else:
          self.assertIn(key, result[config])