def setUp(self): self.rbac_patcher = mock.patch("drift.views.v1.view_helpers.ensure_has_role") patched_rbac = self.rbac_patcher.start() patched_rbac.return_value = None # validate all RBAC requests self.addCleanup(self.stopPatches) test_connexion_app = app.create_app() test_flask_app = test_connexion_app.app self.client = test_flask_app.test_client()
def setUp(self): test_connexion_app = app.create_app() test_flask_app = test_connexion_app.app self.client = test_flask_app.test_client() self.stream = StringIO() self.handler = logging.StreamHandler(self.stream) test_flask_app.logger.addHandler(self.handler) test_flask_app.logger.setLevel(logging.DEBUG)
def setUp(self): test_connexion_app = app.create_app() test_flask_app = test_connexion_app.app self.client = test_flask_app.test_client() self.mock_logger = mock.Mock() self.mock_counters = { "systems_compared_no_sysprofile": mock.MagicMock(), "inventory_service_requests": mock.MagicMock(), "inventory_service_exceptions": mock.MagicMock(), }
def setUp(self): self.rbac_patcher = mock.patch( "drift.views.v1.view_helpers.ensure_has_permission") patched_rbac = self.rbac_patcher.start() patched_rbac.return_value = None # validate all RBAC requests test_connexion_app = app.create_app() test_flask_app = test_connexion_app.app self.client = test_flask_app.test_client() self.stream = StringIO() self.handler = logging.StreamHandler(self.stream) test_flask_app.logger.addHandler(self.handler) test_flask_app.logger.setLevel(logging.DEBUG)
def setUp(self): test_connexion_app = app.create_app() test_flask_app = test_connexion_app.app self.client = test_flask_app.test_client()
"--write", action="store_true", help="write a new report instead of comparing. This should only be used" " when the report format has been updated, and you have manually" " verified that the new report is correct!", ) args = parser.parse_args() conf = None with open(args.conf_file, "r") as conf_fh: conf = toml.load(conf_fh) print("Testing report generation...") # TODO: remove need to initialize flask app app = create_app() app.app.app_context().push() for report in conf: systems_with_profiles, baselines, hsps, expected_output = _read_inputs( **conf[report]) comparisons = info_parser.build_comparisons( systems_with_profiles, baselines, hsps, None, False, ) if args.write: outpath = conf[report]["expected_output_path"] with open(outpath, "w") as outfile:
def setUp(self): test_connexion_app = app.create_app() test_flask_app = test_connexion_app.app self.client = test_flask_app.test_client() self.mock_logger = mock.Mock()
from drift.app import create_app create_app().run(host="0.0.0.0", port=8085)
from drift.app import create_app application = create_app() if __name__ == "__main__": application.run()
from drift.app import create_app create_app().run(host='0.0.0.0', port=8080)