def test_run(self): for mod in (agentstate, capture, ingest, schedule): mod.run = should_fail sys.argv = ['pyca', mod.__name__.split('.')[-1]] try: __main__.main() assert False except ShouldFailException: assert True # Test ui start ui.app.run = should_fail sys.argv = ['pyca', 'ui'] try: __main__.main() assert False except ShouldFailException: assert True # Test run all for mod in (agentstate, capture, ingest, schedule): mod.run = lambda: True sys.argv = ['pyca', 'run'] try: __main__.main() except: assert False for mod in (agentstate, capture, ingest, schedule): reload(mod)
def test_http_request_mocked_curl(self): config.config()['server']['insecure'] = True config.config()['server']['certificate'] = 'nowhere' utils.pycurl.Curl = CurlMock try: utils.http_request('http://127.0.0.1:8', [('x', 'y')]) except Exception: self.fail() reload(utils.pycurl)
def test_http_request_mocked_curl(self): config.config()['server']['insecure'] = True config.config()['server']['certificate'] = 'nowhere' utils.pycurl.Curl = CurlMock try: utils.http_request('http://127.0.0.1:8', [('x', 'y')]) assert True except Exception: assert False reload(utils.pycurl)
def tearDown(self): os.close(self.fd) os.remove(self.dbfile) shutil.rmtree(self.cadir) reload(capture) reload(config) reload(utils)
def test_run(self): for mod in (agentstate, capture, ingest, schedule): mod.run = should_fail sys.argv = ['pyca', mod.__name__.split('.')[-1]] with self.assertRaises(ShouldFailException): __main__.main() # Test ui start ui.app.run = should_fail sys.argv = ['pyca', 'ui'] with self.assertRaises(ShouldFailException): __main__.main() # Test run all for mod in (agentstate, capture, ingest, schedule): mod.run = lambda: True sys.argv = ['pyca', 'run'] try: __main__.main() except Exception: self.fail() for mod in (agentstate, capture, ingest, schedule): reload(mod)
def tearDown(self): os.close(self.fd) os.remove(self.dbfile) reload(utils) reload(schedule)
def tearDown(self): os.close(self.fd) os.remove(self.dbfile) reload(utils) reload(config)
def teardown(self): reload(sys)
def tearDown(self): os.close(self.fd) os.remove(self.dbfile) shutil.rmtree(self.cadir) reload(ingest) reload(utils)