def test_downloads_only_once(toolchain_db, feed): boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(boost_package, with_path=False, with_url=True) with mock.patch.object(toolchain_db, "download_package") as mock_dl: toolchain_db.update(feed.url) toolchain_db.update(feed.url) assert mock_dl.call_count == 1
def test_feed(feed): boost_package = qitoolchain.qipackage.QiPackage("boost", "1.42") boost_package.url = "ftp://example.org/boost-1.42.zip" feed.add_package(boost_package) parser = qitoolchain.feed.ToolchainFeedParser() parser.parse(feed.url) packages = parser.get_packages() assert packages[0].url == boost_package.url
def test_feed(feed): boost_package = qitoolchain.qipackage.QiPackage("boost", "1.42") boost_package.url = "ftp://example.org/boost-1.42.zip" feed.add_package(boost_package) parser = qitoolchain.feed.ToolchainFeedParser("foo") parser.parse(feed.url) packages = parser.get_packages() assert packages[0].url == boost_package.url
def test_package_removed_from_feed(toolchain_db, feed): boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(boost_package) toolchain_db.update(feed.url) feed.remove_package("boost") toolchain_db.update(feed.url) assert not toolchain_db.packages
def test_package_removed_from_feed(toolchain_db, feed): """ Test Package Removed from Feed """ boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(boost_package) toolchain_db.update(feed.url) boost_path = toolchain_db.get_package_path("boost") feed.remove_package("boost") toolchain_db.update(feed.url) assert not toolchain_db.packages assert not os.path.exists(boost_path)
def test_downloads_only_once(toolchain_db, feed): boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(boost_package, with_path=False, with_url=True) with mock.patch.object(qisys.remote, "download") as mock_dl: with mock.patch.object(qitoolchain.qipackage, "extract") as mock_extract: mock_dl.return_value = "/path/to/boost.zip" toolchain_db.update(feed.url) toolchain_db.update(feed.url) assert mock_dl.call_count == 1 assert mock_extract.call_count == 1 assert mock_extract.call_args_list[0][0][0] == "/path/to/boost.zip"
def test_downgrading_package(toolchain_db, feed): boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44") feed.add_package(boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == boost_package old_boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(old_boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == old_boost_package
def test_update(toolchain_db, feed): boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == boost_package new_boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44") feed.add_package(new_boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == new_boost_package
def test_downgrading_package(toolchain_db, feed): """ Test Downgrading Package """ boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44") feed.add_package(boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == boost_package feed.remove_package("boost") old_boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(old_boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == old_boost_package
def test_svn_package_conflict(toolchain_db, feed, svn_server): """ Test SVN Package Conflict """ boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44") feed.add_package(boost_package) toolchain = qitoolchain.toolchain.Toolchain("foo") toolchain.update(feed.url) boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "version.hpp", '#define BOOST_VERSION "1_55"\n') svn_package = qitoolchain.svn_package.SvnPackage("boost") svn_package.url = boost_url feed.add_svn_package(svn_package) toolchain.update(feed.url)
def test_update(toolchain_db, feed): """ Test Update """ boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") boost_package.path = "/path/to/boost" feed.add_package(boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == boost_package new_boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44") new_boost_package.path = "/path/to/boost" feed.add_package(new_boost_package) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"] == new_boost_package
def test_git_feed(toolchain_db, feed, git_server): """ Test Git Feed """ boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44") feed.add_package(boost_package) git_server.create_repo("toolchains.git") git_server.push_file("toolchains.git", "feeds/foo.xml", feed.feed_xml.read()) url = git_server.get_repo("toolchains.git").clone_url toolchain = qitoolchain.toolchain.Toolchain("foo") toolchain.update(url, branch="master", name="foo") boost = toolchain.get_package("boost") assert boost.version == "1.44" new_boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.55") feed.add_package(new_boost_package) git_server.push_file("toolchains.git", "feeds/foo.xml", feed.feed_xml.read()) toolchain.update() boost = toolchain.get_package("boost") assert boost.version == "1.55"
def test_downloads_remote_package(toolchain_db, feed): boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.42") feed.add_package(boost_package, with_path=False, with_url=True) toolchain_db.update(feed.url) assert toolchain_db.packages["boost"].path