def dependency(version, dependency_version): d = Dependency(component_version_id=version.id, dependency_version_id=dependency_version.id) session.add(d) session.commit() yield d if Dependency.query.get(d.id): session.delete(d) session.commit()
def dependency_version(dependency_component): """A second randomly generated version of a secondly randomly generated component""" v = _make_version(dependency_component) session.add(v) session.commit() yield v if Version.query.get(v.id): session.delete(v) session.commit()
def version(component): """A randomly generated version of a randomly generated component""" v = _make_version(component) session.add(v) session.commit() yield v if Version.query.get(v.id): session.delete(v) session.commit()
def dependency_component(app): """A second randomly generated component""" c = _make_component() session.add(c) session.commit() yield c if Component.query.get(c.id): session.delete(c) session.commit()
def delete_dependency(dependency_id): """Delete a single dependency Delete a dependency :param dependency_id: :type dependency_id: str :rtype: None """ dependency = Dependency.query.get(dependency_id) if dependency: session.delete(dependency) session.commit() return "Deleted", 200 else: return "Dependency not found", 404
def delete_component(component_id): """Delete a single component Delete a component :param component_id: :type component_id: str :rtype: None """ component = Component.query.get(component_id) if component: session.delete(component) session.commit() return "Deleted", 200 else: return "Component not found", 404
def delete_version(version_id): """Delete a single version Delete a version :param version_id: :type version_id: str :rtype: None """ version = Version.query.get(version_id) if version: session.delete(version) session.commit() return "Deleted", 200 else: return "Version not found", 404