コード例 #1
0
def main(argv=None):
  testing_startup.TestInit()
  if flags.FLAGS.generate:
    testing_startup.TestInit()
    ApiRegressionGoldenOutputGenerator(flags.FLAGS.generate).Generate()
  else:
    test_lib.main(argv)
コード例 #2
0
ファイル: testing.py プロジェクト: skirankumar/grr
 def setUpClass(cls):
     # TODO(hanuszczak): See comment about `TestInit` in `ColabTestMixin`.
     # Testing startup has to be called before `setUpClass` of the superclass,
     # because it requires things like the configuration system to be already
     # initialized.
     testing_startup.TestInit()
     super(ColabE2ETest, cls).setUpClass()
コード例 #3
0
ファイル: conftest.py プロジェクト: youngjun-chang/grr
def pytest_runtest_setup(item):
    """A pytest hook that is called before each test item is executed."""
    # We need to re-initialize flags (and hence also testing setup) because
    # various modules might have various flags defined.
    global last_module
    if last_module != item.module:
        flags.Initialize()
        testing_startup.TestInit()
    last_module = item.module
コード例 #4
0
  def setUpClass(cls) -> None:
    """Performs all initialization needed to interface with GRR's API."""
    # This is a mixin class intended to be used with `absltest.TestCase`.
    super(ColabTestMixin, cls).setUpClass()  # pytype: disable=attribute-error

    # TODO(hanuszczak): `TestInit` is awful, does a lot of unnecessary stuff and
    # should be avoided. However, because of all the global state that GRR has
    # currently, it is extremely hard figure out which parts need initialization
    # and which do not. Once AFF4 is gone, hopefully this should become much
    # simpler and `TestInit` will no longer be necessary.
    testing_startup.TestInit()

    port = portpicker.pick_unused_port()

    cls._server_thread = wsgiapp_testlib.ServerThread(port, name="ServerThread")
    cls._server_thread.StartAndWaitUntilServing()

    _api._API = api.InitHttp(api_endpoint="http://localhost:{}".format(port))  # pylint: disable=protected-access
コード例 #5
0
def main(argv):
    """Entry function."""
    del argv
    testing_startup.TestInit()

    mysql_test.TestMysqlDB.setUpClass()
    try:
        # TODO(user): refactor the code to not use protected methods.
        db, fin = mysql_test.TestMysqlDB._CreateDatabase()  # pylint: disable=protected-access
        try:

            def _DumpSchema(conn):
                with contextlib.closing(conn.cursor()) as cursor:
                    return mysql_migration.DumpCurrentSchema(cursor)

            schema = db._RunInTransaction(_DumpSchema)  # pylint: disable=protected-access
            print(schema)
        finally:
            fin()

    finally:
        mysql_test.TestMysqlDB.tearDownClass()
コード例 #6
0
def main(argv=None):
  del argv  # Unused.
  testing_startup.TestInit()
  absltest.main()
コード例 #7
0
 def setUpClass(cls):
     super(YaraProcessScanTest, cls).setUpClass()
     testing_startup.TestInit()
コード例 #8
0
 def setUpClass(cls):
     super(GRRBaseTest, cls).setUpClass()
     with GRRBaseTest._set_up_lock:
         if not GRRBaseTest._set_up_done:
             testing_startup.TestInit()
             GRRBaseTest._set_up_done = True
コード例 #9
0
 def setUpClass(cls):
     super(ApiUploadYaraSignatureHandlerTest, cls).setUpClass()
     testing_startup.TestInit()
コード例 #10
0
ファイル: timeline_test.py プロジェクト: secureonelabs/grr
 def setUpClass(cls):
     super(TimelineTest, cls).setUpClass()
     testing_startup.TestInit()
コード例 #11
0
 def setUpClass(cls):
     super(CronJobRegistryTest, cls).setUpClass()
     testing_startup.TestInit()
コード例 #12
0
ファイル: pipes_test.py プロジェクト: khanhgithead/grr
 def setUpClass(cls):
     super().setUpClass()
     testing_startup.TestInit()
コード例 #13
0
 def setUpClass(cls):
     super(ApiGetCollectedTimelineHandlerTest, cls).setUpClass()
     testing_startup.TestInit()
コード例 #14
0
def main(argv=None):
    del argv  # Unused.
    flags.Initialize()
    testing_startup.TestInit()
    absltest.main()
コード例 #15
0
    def setUpClass(cls):
        super(CronJobRegistryTest, cls).setUpClass()

        testing_startup.TestInit()
        with test_lib.ConfigOverrider({"Server.initialized": True}):
            server_startup.Init()
コード例 #16
0
 def setUpClass(cls):
   testing_startup.TestInit()
   super(MySQLYaraTest, cls).setUpClass()