예제 #1
0
    def Run(self):
        config_obj = config_lib.GrrConfigManager()
        config_obj.DEFINE_bool("SectionFoo.sample_boolean_option", True,
                               "Regression test sample boolean option.")
        config_obj.DEFINE_integer("SectionFoo.sample_integer_option", 42,
                                  "Sample integer option.")
        config_obj.DEFINE_string("SectionBar.sample_string_option", "",
                                 "Sample string option.")
        config_obj.DEFINE_list("SectionBar.sample_list_option", [],
                               "Sample list option.")
        # This has to be defined as http_api.HttpRequestHandler.HandleRequest
        # depends on it and regression data won't get rendered without
        # this config option defined.
        config_obj.DEFINE_string("AdminUI.debug_impersonate_user", None, "")

        config = """
SectionFoo.sample_boolean_option: True
SectionBar.sample_string_option: "%(sAmPlE|lower)"
"""

        config_lib.LoadConfig(config_obj,
                              config_fd=StringIO.StringIO(config),
                              parser=config_lib.YamlParser)

        with utils.Stubber(config_lib, "CONFIG", config_obj):
            self.Check("GET", "/api/config")
예제 #2
0
  def Run(self):
    config_obj = config_lib.GrrConfigManager()
    config_obj.DEFINE_string("SectionFoo.sample_string_option", "",
                             "Sample string option.")
    config_obj.DEFINE_string("Mysql.database_password", "",
                             "Secret password.")

    config = """
SectionBar.sample_string_option: "%(sAmPlE|lower)"
Mysql.database_password: "******"
"""

    config_lib.LoadConfig(config_obj, StringIO.StringIO(config),
                          parser=config_lib.YamlParser)

    with utils.Stubber(config_lib, "CONFIG", config_obj):
      self.Check("GET", "/api/config/SectionFoo.sample_string_option")
      self.Check("GET", "/api/config/Mysql.database_password")
      self.Check("GET", "/api/config/NonExistingOption")
예제 #3
0
파일: config_test.py 프로젝트: zzzzpaul/grr
  def Run(self):
    config_obj = config_lib.GrrConfigManager()
    config_obj.DEFINE_bool("SectionFoo.sample_boolean_option", True,
                           "Regression test sample boolean option.")
    config_obj.DEFINE_integer("SectionFoo.sample_integer_option", 42,
                              "Sample integer option.")
    config_obj.DEFINE_string("SectionBar.sample_string_option", "",
                             "Sample string option.")
    config_obj.DEFINE_list("SectionBar.sample_list_option", [],
                           "Sample list option.")

    config = """
SectionFoo.sample_boolean_option: True
SectionBar.sample_string_option: "%(sAmPlE|lower)"
"""

    config_lib.LoadConfig(config_obj, StringIO.StringIO(config),
                          parser=config_lib.YamlParser)

    with utils.Stubber(config_lib, "CONFIG", config_obj):
      self.Check("GET", "/api/config")
예제 #4
0
    def Run(self):
        config_obj = config_lib.GrrConfigManager()
        config_obj.DEFINE_string("SectionFoo.sample_string_option", "",
                                 "Sample string option.")
        config_obj.DEFINE_string("Mysql.database_password", "",
                                 "Secret password.")
        # This has to be defined as http_api.HttpRequestHandler.HandleRequest
        # depends on it and regression data won't get rendered without
        # this config option defined.
        config_obj.DEFINE_string("AdminUI.debug_impersonate_user", None, "")

        config = """
SectionBar.sample_string_option: "%(sAmPlE|lower)"
Mysql.database_password: "******"
"""

        config_lib.LoadConfig(config_obj,
                              config_fd=StringIO.StringIO(config),
                              parser=config_lib.YamlParser)

        with utils.Stubber(config_lib, "CONFIG", config_obj):
            self.Check("GET", "/api/config/SectionFoo.sample_string_option")
            self.Check("GET", "/api/config/Mysql.database_password")
            self.Check("GET", "/api/config/NonExistingOption")