コード例 #1
0
ファイル: scenarios.py プロジェクト: alltheshot768/RootAsRole
 def testScenario1(self):
     port = "79"
     utils.before("scenario1",
                  [utils.getuser(), constants.SC1_FILE_SERVERPY, port])
     res, code = utils.sr_cmd(
         "-r role1 -c 'python %s -p %s'" %
         (constants.SC1_FILE_SERVERPY, port), 1)
     utils.multipleAssertCommand(res, code, code == 0, res.count("OK") == 1)
     utils.after()
コード例 #2
0
 def testUserInfoCommandArgNoRole(self):
     utils.before("testInfo/infousernorole")
     res, code = utils.sr_cmd("-i -c null")
     utils.multipleAssertCommand(
         res, code, code == 0,
         utils.assertCount(res, r"you can\\'t execute this command", 1),
         utils.assertCount(res, "sr -c", 0),
         utils.assertCount(res, "roles", 0),
         utils.assertCount(res, "null", 0))
     utils.after()
コード例 #3
0
ファイル: __init__.py プロジェクト: alltheshot768/RootAsRole
def signal_handler(sig, frame):
    if path.exists(constants.TEMP_XML):
        utilsTests.after()
    sys.exit(0)
コード例 #4
0
ファイル: __init__.py プロジェクト: alltheshot768/RootAsRole

def readTestSuite(loader, testsuit, suite):
    for test_class in suite:
        tests = loader.loadTestsFromTestCase(test_class)
        testsuit.addTests(tests)


def load_tests(loader, tests, pattern):
    suite = unittest.TestSuite()
    readTestSuite(loader, suite, test_Roles)
    readTestSuite(loader, suite, test_Global)
    readTestSuite(loader, suite, test_Info)
    return suite


def signal_handler(sig, frame):
    if path.exists(constants.TEMP_XML):
        utilsTests.after()
    sys.exit(0)


if __name__ == '__main__':
    if str(currentcaps).find("cap_dac_override") < 0:
        print("please run this with sr")
        exit(-1)
    signal.signal(signal.SIGINT, signal_handler)
    unittest.main()
    utilsTests.after()

libcap.cap_free(currentcaps)
コード例 #5
0
 def tearDown(self):
     utils.after()
     return super().tearDown()