def test_process_success_waiting_for_package_different_revision(self): build_output = _setup_build_output("create.json") with database.session_scope() as session: ecosystem = util.create_ecosystem(dict()) waiting_build_id = _create_waiting_build( session, ecosystem, missing_packages=[ util.create_package({ "ecosystem": ecosystem, "recipe_revision.revision": "f5c1ba6f1af634f500f7e0255619fecf4777965f" }) ]) build_id = _create_build(session, ecosystem) result = manager.process_success(build_id, build_output) self.assertTrue(result["new_builds"]) with database.session_scope() as session: waiting_build = session.query( database.Build).filter_by(id=waiting_build_id).first() self.assertEqual(database.BuildStatus.new, waiting_build.status)
def test_process_success_waiting_for_package_different_package_id(self): build_output = _setup_build_output("create.json") with database.session_scope() as session: ecosystem = util.create_ecosystem(dict()) waiting_build_id = _create_waiting_build( session, ecosystem, missing_packages=[ util.create_package({ "ecosystem": ecosystem, "package.package_id": "d057732059ea44a47760900cb5e4855d2bea8714" }) ]) build_id = _create_build(session, ecosystem) result = manager.process_success(build_id, build_output) self.assertFalse("new_builds" in result.keys()) with database.session_scope() as session: waiting_build = session.query( database.Build).filter_by(id=waiting_build_id).first() self.assertEqual(database.BuildStatus.error, waiting_build.status)
def test_process_success_waiting_for_recipe(self): build_output = _setup_build_output("create.json") with database.session_scope() as session: ecosystem = util.create_ecosystem(dict()) waiting_build_id = _create_waiting_build( session, ecosystem, missing_recipes=[util.create_recipe({"ecosystem": ecosystem})]) build_id = _create_build(session, ecosystem) result = manager.process_success(build_id, build_output) self.assertTrue(result["new_builds"]) with database.session_scope() as session: waiting_build = session.query( database.Build).filter_by(id=waiting_build_id).first() self.assertEqual(database.BuildStatus.new, waiting_build.status)
def setUp(self): super().setUp() with database.session_scope() as session: ecosystem = util.create_ecosystem(dict()) session.add(ecosystem)