示例#1
0
 def GetConfig(self):
     """Read in the test configuration file."""
     parser = config_file.SshdConfigParser()
     # TODO(hanuszczak): Configuration file, consider using `StringIO` instead.
     results = list(parser.Parse(None, io.BytesIO(CFG), None))
     self.assertEqual(1, len(results))
     return results[0]
示例#2
0
def GetSSHDConfig():
  if SSHD_CFG:
    return SSHD_CFG

  # Load an sshd config
  parser = config_file_parsers.SshdConfigParser()
  test_data = os.path.join(config.CONFIG["Test.data_dir"],
                           "VFSFixture/etc/ssh/sshd_config")
  with open(test_data, "rb") as f:
    SSHD_CFG.extend(parser.Parse(None, f, None))
  return SSHD_CFG
示例#3
0
  def setUpClass(cls):
    super(SshdCheckTests, cls).setUpClass()

    cls.LoadCheck("sshd.yaml")
    cls.parser = config_file.SshdConfigParser()
示例#4
0
 def GetConfig(self):
     """Read in the test configuration file."""
     parser = config_file.SshdConfigParser()
     results = list(parser.Parse(None, io.BytesIO(CFG), None))
     self.assertEqual(1, len(results))
     return results[0]
示例#5
0
 def GetConfig(self):
     """Read in the test configuration file."""
     parser = config_file.SshdConfigParser()
     results = list(parser.ParseFile(None, None, io.BytesIO(CFG)))
     self.assertLen(results, 1)
     return results[0]