Kaydet (Commit) 1929b7cf authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Testler biraz elden gecirildi. Su an daha saglam bir halde. Birkac ufak isten…

Testler biraz elden gecirildi. Su an daha saglam bir halde. Birkac ufak isten sonra testlerimiz cok daha anlasilir olacak
üst 5a984fd4
......@@ -125,7 +125,7 @@ Legend:
+ ciksemel based modules rewrite with xml.dom.minidom (Zaryob)
/ partial caching and automatic resume for file download (meren)
+ use a '.part' extension
- resume file downloading (Darara.... fetcher will rewrite with httplib) (Zaryob)
- resume file downloading (Darara.... fetcher will rewrite with requests) (Zaryob)
+ search-file command (eray)
+ exception handling (eray)
+ uniform exception hierarchy
......@@ -218,7 +218,7 @@ Legend:
+ accelerate search
/ package signing
/ an embebed package signer.(aquila)
/ an embebed package signer.(Zaryob)
+ a flag to sign package after building
/ code to check if the package has a valid signature
- cli improvements
......
repos/*-bin/
repos/repo1/
repos/repo2/
repos/tmp/
inary-index.xml*
tests/
......@@ -22,64 +22,66 @@ class ComponentDBTestCase(testcase.TestCase):
def testHasComponent(self):
assert self.componentdb.has_component("system.base", "repo1")
assert not self.componentdb.has_component("floct.flict", "repo1")
assert self.componentdb.has_component("util.misc", "repo2")
assert self.componentdb.has_component("applications.network", "repo2")
assert not self.componentdb.has_component("floct.flict", "repo2")
assert self.componentdb.has_component("multimedia.graphics")
assert self.componentdb.has_component("applications.util")
def testListComponents(self):
assert set(self.componentdb.list_components("repo1")) == set(["system", "system.base",
"system.devel", "util",
"desktop", "desktop.accessibility",
"multimedia", "multimedia.graphics"])
assert set(self.componentdb.list_components("repo2")) == set(["system", "system.base",
"util", "util.admin", "util.misc"])
"applications"])
assert set(self.componentdb.list_components("repo2")) == set(["applications", "applications.util",
"applications.network"])
assert set(self.componentdb.list_components()) == set(["system", "system.base",
"applications", "applications.network",
"applications.util"])
def testGetComponent(self):
component = self.componentdb.get_component("system.base", "repo1")
assert component.name == "system.base"
assert "bash" in component.packages
assert "gnuconfig" not in component.packages
component = self.componentdb.get_component("applications.network")
assert component.name == "applications.network"
assert "ncftp" in component.packages
assert "lynx" not in component.packages
component = self.componentdb.get_component("util.misc", "repo2")
assert component.name == "util"
assert "dialog" in component.packages
assert "jpeg" not in component.packages
component = self.componentdb.get_component("applications.network", "repo2")
assert component.name == "applications.network"
assert "lynx" in component.packages
assert "ncftp" not in component.packages
def testGetUnionComponent(self):
component = self.componentdb.get_union_component("multimedia.graphics", "repo1")
assert component.name == "multimedia.graphics"
assert "jpeg" in component.packages
assert "dialog" in component.packages
component = self.componentdb.get_union_component("applications.network")
assert component.name == "applications.network"
assert "lynx" in component.packages
assert "ncftp" in component.packages
def testGetPackages(self):
packages = self.componentdb.get_packages("system.devel", "repo1")
assert "xorg-util" in packages
assert "dialog" not in packages
packages = self.componentdb.get_packages("applications.network")
assert "ncftp" in packages
assert "lynx" not in packages
packages = self.componentdb.get_packages("util.misc", "repo2")
assert "dialog" in packages
assert "jpeg" not in packages
packages = self.componentdb.get_packages("applications.network", "repo2")
assert "lynx" in packages
assert "ncftp" not in packages
#Test Walking parameter
packages = self.componentdb.get_packages("util", "repo2", walk = True)
assert "lsof" and "inxi" in packages
assert "ftp" not in packages
packages = self.componentdb.get_packages("applications", "repo2", walk = True)
assert "cpulimit" and "lynx" in packages
assert "ncftp" not in packages
def testGetUnionPackages(self):
packages = self.componentdb.get_union_packages("util", "repo1")
assert "dialog" in packages
assert "tidy" in packages
packages = self.componentdb.get_union_packages("applications.network")
assert "ncftp" in packages
assert "lynx" in packages
assert "cpulimit" not in packages
packages = self.componentdb.get_union_packages("system", 'repo1', walk = True)
assert "gnuconfig" and "ca-certificates" and "bash" in packages
packages = self.componentdb.get_union_packages("applications", walk = True)
assert "ncftp" and "lynx" and "cpulimit" in packages
def testSearchComponent(self):
packages = self.componentdb.search_component(["uti"])
assert set(packages) == set(['util', 'util.admin', 'util.misc'])
packages = self.componentdb.search_component(["applic"])
assert set(packages) == set(['applications', 'applications.network', 'applications.util'])
packages = self.componentdb.search_component(["system", "base"], repo="repo1")
assert set(packages) == set(["system.base"])
packages = self.componentdb.search_component(["system", "devel"], repo="repo2")
packages = self.componentdb.search_component(["system", "base"], repo="repo2")
assert not packages
......@@ -18,27 +18,27 @@ class FilesDBTestCase(testcase.TestCase):
filesdb = inary.db.filesdb.FilesDB()
def testHasFile(self):
assert not self.filesdb.has_file("bin/bash")
inary.api.install(["bash"])
assert self.filesdb.has_file("bin/bash")
inary.api.remove(["bash"])
assert not self.filesdb.has_file("bin/bash")
assert not self.filesdb.has_file("usr/bin/ethtool")
inary.api.install(["ethtool"])
assert self.filesdb.has_file("usr/bin/ethtool")
inary.api.remove(["ethtool"])
assert not self.filesdb.has_file("usr/bin/ethtool")
def testGetFile(self):
inary.api.install(["bash"])
pkg, path = self.filesdb.get_file("bin/bash")
assert pkg == "bash"
assert path == "bin/bash"
inary.api.remove(["bash"])
assert not self.filesdb.has_file("bin/bash")
inary.api.install(["ethtool"])
pkg, path = self.filesdb.get_file("usr/bin/ethtool")
assert pkg == "ethtool"
assert path == "usr/bin/ethtool"
inary.api.remove(["ethtool"])
assert not self.filesdb.has_file("usr/bin/ethtool")
def testAddRemoveFiles(self):
fileinfo1 = inary.files.FileInfo()
fileinfo1 = inary.data.files.FileInfo()
fileinfo1.path = "etc/inary/inary.conf"
fileinfo2 = inary.files.FileInfo()
fileinfo2 = inary.data.files.FileInfo()
fileinfo2.path = "etc/inary/mirrors.conf"
files = inary.files.Files()
files = inary.data.files.Files()
files.list.append(fileinfo1)
files.list.append(fileinfo2)
......@@ -58,11 +58,8 @@ class FilesDBTestCase(testcase.TestCase):
assert not self.filesdb.has_file("etc/inary/inary.conf")
assert not self.filesdb.has_file("etc/inary/mirrors.conf")
def testSearchFile(self):
assert not self.filesdb.search_file("bash")
inary.api.install(["bash"])
found = self.filesdb.search_file("bash")
pkg, files = found[0]
assert set(files) == set(['bin/bash'])
inary.api.remove(["bash"])
assert not self.filesdb.search_file("ethtool")
inary.api.install(["ethtool"])
found = self.filesdb.search_file("ethtool")
......@@ -20,90 +20,91 @@ class InstallDBTestCase(testcase.TestCase):
self.installdb = inary.db.installdb.InstallDB()
def tearDown(self):
inary.api.remove(["dialog", "pv"])
inary.api.remove(["ctorrent", "ethtool"])
def testGetPackage(self):
inary.api.install(["dialog"])
inary.api.install(["ethtool"])
idb = inary.db.installdb.InstallDB()
pkg = idb.get_package("dialog")
pkg = idb.get_package("ethtool")
assert type(pkg) == inary.metadata.Package
assert pkg.name == "dialog"
assert pkg.name == "ethtool"
def testHasPackage(self):
inary.api.install(["dialog"])
inary.api.install(["ethtool"])
self.installdb = inary.db.installdb.InstallDB()
assert not self.installdb.has_package("flipfloo")
assert self.installdb.has_package("dialog")
assert self.installdb.has_package("ethtool")
def testListInstalled(self):
inary.api.install(["openssl"])
inary.api.install(["ethtool"])
self.installdb = inary.db.installdb.InstallDB()
assert set(self.installdb.list_installed()) == set(['zlib', 'ca-certificates',
'run-parts', 'openssl'])
assert set(self.installdb.list_installed()) == set(['zlib', 'pam', 'shadow',
'jpeg', 'libidn', 'db4',
'cracklib', 'openssl',
'curl', 'bash', 'ethtool'])
def testGetVersion(self):
inary.api.install(["dialog"])
inary.api.install(["ethtool"])
self.installdb = inary.db.installdb.InstallDB()
version, release, build = self.installdb.get_version("zlib")
assert version == "1.1_20100428"
assert release == "10"
assert version == "0.3"
assert release == "1"
assert build == None
def testGetFiles(self):
inary.api.install(["bash"])
inary.api.install(["ethtool"])
self.installdb = inary.db.installdb.InstallDB()
files = self.installdb.get_files("bash")
assert files.list[0].path == "bin/bash"
files = self.installdb.get_files("ethtool")
assert files.list[0].path == "usr/bin/ethtool"
def testGetInfo(self):
inary.api.install(["dialog"])
inary.api.install(["ethtool"])
idb = inary.db.installdb.InstallDB()
info = idb.get_info("dialog")
info = idb.get_info("ethtool")
self.assertTrue(isinstance(info, inary.db.installdb.InstallInfo))
self.assertEqual(info.version, "1.1_20100428")
self.assertEqual(info.version, "0.3")
#FIXME: Yuksek ihtimal calismayacak
def testGetReverseDependencies(self):
inary.api.install(["pv"])
inary.api.install(["dialog"])
inary.api.install(["ethtool"])
inary.api.install(["ctorrent"])
self.installdb = inary.db.installdb.InstallDB()
revdeps = self.installdb.get_rev_deps("openssl")
assert set(["pv", "dialog"]) == set([x[0] for x in revdeps])
assert set(["ctorrent", "curl"]) == set(map(lambda x:x[0], revdeps))
def testAddRemovePackage(self):
inary.api.install(["pv"])
inary.api.install(["ctorrent"])
self.installdb = inary.db.installdb.InstallDB()
assert self.installdb.has_package("pv")
assert not self.installdb.has_package("dialog")
inary.api.install(["dialog"])
assert self.installdb.has_package("ctorrent")
assert not self.installdb.has_package("ethtool")
inary.api.install(["ethtool"])
self.installdb = inary.db.installdb.InstallDB()
assert self.installdb.has_package("pv")
assert self.installdb.has_package("dialog")
assert self.installdb.has_package("ctorrent")
assert self.installdb.has_package("ethtool")
def testMarkListPending(self):
inary.api.set_scom(False)
assert not self.installdb.has_package("openssl")
inary.api.install(["openssl"])
assert "openssl" in self.installdb.list_pending()
inary.api.remove(["openssl"])
assert "openssl" not in self.installdb.list_pending()
assert not self.installdb.has_package("ethtool")
inary.api.install(["ethtool"])
assert "ethtool" in self.installdb.list_pending()
inary.api.remove(["ethtool"])
assert "ethtool" not in self.installdb.list_pending()
inary.api.set_scom(True)
def testClearPending(self):
inary.api.set_scom(False)
assert not self.installdb.has_package("openssl")
inary.api.install(["openssl"])
assert "openssl" in self.installdb.list_pending()
self.installdb.clear_pending("openssl")
assert "openssl" not in self.installdb.list_pending()
inary.api.remove(["openssl"])
assert "openssl" not in self.installdb.list_pending()
assert not self.installdb.has_package("ethtool")
inary.api.install(["ethtool"])
assert "ethtool" in self.installdb.list_pending()
self.installdb.clear_pending("ethtool")
assert "ethtool" not in self.installdb.list_pending()
inary.api.remove(["ethtool"])
assert "ethtool" not in self.installdb.list_pending()
inary.api.set_scom(True)
def testSearchPackage(self):
self.installdb = inary.db.installdb.InstallDB()
assert not self.installdb.has_package("tidy")
assert not self.installdb.search_package(["tidy"])
inary.api.install(["tidy"])
assert not self.installdb.has_package("ethtool")
assert not self.installdb.search_package(["ethtool"])
inary.api.install(["ethtool"])
self.installdb = inary.db.installdb.InstallDB()
assert self.installdb.search_package(["tid", "idy", "t"]) == ["tidy"]
assert self.installdb.search_package(["et", "tool", "h"]) == ["ethtool"]
......@@ -11,6 +11,7 @@
#
from . import testcase
import inary.db.itembyrepo
class TestDB:
......@@ -35,7 +36,7 @@ class TestDB:
if repo:
repos = [repo]
return repos
self.tdb.item_repos = item_repos
self.odb.item_repos = item_repos
......
......@@ -31,7 +31,7 @@ class LazyDBTestCase(unittest.TestCase):
def testDatabaseWithoutInit(self):
db = TestDB()
assert "testfield" not in db.__dict__
assert not "testfield" in db.__dict__
db._delete()
def testSingletonBehaviour(self):
......
......@@ -11,50 +11,51 @@
#
from . import testcase
import inary
class PackageDBTestCase(testcase.TestCase):
def setUp(self):
testcase.TestCase.setUp(self)
self.packagedb = inary.db.packagedb.PackageDB()
def testGetPackage(self):
pkg = self.packagedb.get_package("tidy", "repo1")
assert pkg.name == "tidy"
pkg = self.packagedb.get_package("ncftp", "repo1")
assert pkg.name == "ncftp"
pkg = self.packagedb.get_package("most", "repo2")
assert pkg.name == "most"
pkg = self.packagedb.get_package("lynx", "repo2")
assert pkg.name == "lynx"
pkg = self.packagedb.get_package("lsof")
assert pkg.name == "lsof"
pkg = self.packagedb.get_package("cpulimit")
assert pkg.name == "cpulimit"
def testHasPackage(self):
assert self.packagedb.has_package("tidy", "repo1")
assert not self.packagedb.has_package("most", "repo2")
assert self.packagedb.has_package("lsof")
assert self.packagedb.has_package("ncftp", "repo1")
assert not self.packagedb.has_package("ncftp", "repo2")
assert self.packagedb.has_package("lynx")
def testGetVersion(self):
version, release, build = self.packagedb.get_version("most", "repo2")
assert version == "5,1_pre6"
assert release == "2"
version, release, build = self.packagedb.get_version("lynx", "repo2")
assert version == "0.3"
assert release == "1"
def testWhichRepo(self):
assert self.packagedb.which_repo("lsof") == "repo2"
assert self.packagedb.which_repo("lynx") == "repo2"
def testGetPackageAndRepository(self):
pkg, repo = self.packagedb.get_package_repo("lsof")
assert pkg.name == "lsof"
pkg, repo = self.packagedb.get_package_repo("cpulimit")
assert pkg.name == "cpulimit"
assert repo == "repo2"
def testGetObsoletes(self):
assert set(self.packagedb.get_obsoletes("repo1")) == set(["live-system", "live-streams"])
assert set(self.packagedb.get_obsoletes("repo2")) == set(["live-area"])
assert set(self.packagedb.get_obsoletes()) == set(["live-system", "live-streams", "live-area"])
assert set(self.packagedb.get_obsoletes("repo1")) == set(["wengophone", "rar"])
assert set(self.packagedb.get_obsoletes("repo2")) == set(["xara"])
assert set(self.packagedb.get_obsoletes()) == set(["wengophone", "rar", "xara"])
def testGetReverseDependencies(self):
pkg, dep = self.packagedb.get_rev_deps("openssl")[0]
assert pkg == "zlib"
assert pkg == "curl"
assert str(dep) == "openssl"
def testGetReplaces(self):
......@@ -62,19 +63,17 @@ class PackageDBTestCase(testcase.TestCase):
assert not self.packagedb.get_replaces()
def testListPackages(self):
assert set(self.packagedb.list_packages("repo1")) == set(['liblouis','jpeg','jpeg-devel','jpeg-32bit',
'tidy', 'tidy-devel', 'vlock', 'pv', 'dialog',
'zlib','zlib-devel', 'zlib-32bit', 'minizip',
'minizip-devel', 'ncurses', 'ncurses-devel',
'ncurses-32bit', 'bash', 'ca-certificates',
'openssl', 'openssl-devel', 'openssl-32bit',
'run-parts', 'xorg-util', 'gnuconfig', 'uif2iso'])
assert set(self.packagedb.list_packages("repo1")) == set(['nfdump', 'ethtool', 'ncftp',
'libidn', 'zlib', 'db4', 'openssl',
'jpeg', 'pam', 'shadow', 'bogofilter',
'curl', 'gsl', 'bash', 'cracklib'])
assert set(self.packagedb.list_packages("repo2")) == set(['lsof', 'most', 'dialog', 'inxi'])
assert set(self.packagedb.list_packages("repo2")) == set(['libpcap', 'ctorrent', 'lft', 'lynx',
'iat', 'cpulimit', 'rpl'])
def testSearchPackage(self):
packages = self.packagedb.search_package(["dial"])
assert packages == ["dialog"]
packages = self.packagedb.search_package(["bogo", "filter"])
packages = ["bogofilter"]
packages = self.packagedb.search_package(["devel"], repo="repo1")
assert packages == set(["openssl-devel","tidy-devel", "ncurses-devel", "jpeg-devel", "zlib-devel"])
packages = self.packagedb.search_package(["cpu", "limit"], repo="repo2")
packages = ["cpulimit"]
......@@ -21,7 +21,7 @@ class RepoDBTestCase(testcase.TestCase):
def testAddRemoveRepo(self):
assert "repo2-src" not in self.repodb.list_repos()
repo = inary.db.repodb.Repo(inary.uri.URI("../repos/repo2/inary-index.xml"))
repo = inary.db.repodb.Repo(inary.uri.URI("repos/repo2/inary-index.xml"))
self.repodb.add_repo("repo2-src", repo)
assert "repo2-src" in self.repodb.list_repos()
self.repodb.remove_repo("repo2-src")
......@@ -51,7 +51,7 @@ class RepoDBTestCase(testcase.TestCase):
def testGetRepo(self):
repo = self.repodb.get_repo("repo1")
uri = repo.indexuri
assert uri.get_uri() == "../repos/repo1-bin/inary-index.xml"
assert uri.get_uri() == "repos/repo1-bin/inary-index.xml"
def testRepoOrder(self):
repoorder = inary.db.repodb.RepoOrder()
......
......@@ -9,9 +9,14 @@
# Please read the COPYING file.
#
import unittest import os import inary.search import inary.db as db
#import inary.db.lockeddbshelve as shelve
import testcase class SearchTestCase(testcase.TestCase):
import unittest
import os
import inary.search
import inary.db as db
from . import testcase
class SearchTestCase(testcase.TestCase):
def setUp(self):
testcase.TestCase.setUp(self, database = True)
def testSearch(self):
......
......@@ -11,6 +11,7 @@
#
from . import testcase
import inary
class SourceDBTestCase(testcase.TestCase):
......@@ -22,40 +23,39 @@ class SourceDBTestCase(testcase.TestCase):
def testListSources(self):
assert set(self.sourcedb.list_sources()) == set(['bash', 'ca-certificates', 'dialog', 'gnuconfig',
'zlib', 'pv', 'openssl', 'jpeg', 'liblouis', 'tidy',
'xorg-util', 'vlock', 'run-parts', 'ncurses', 'uif2iso' ])
assert set(self.sourcedb.list_sources()) == set(['ethtool', 'nfdump', 'shadow', 'libidn',
'zlib', 'db4', 'openssl', 'jpeg', 'gsl',
'curl', 'bogofilter', 'ncftp', 'pam',
'bash', 'cracklib'])
def testHasSpec(self):
assert self.sourcedb.has_spec("bash")
assert not self.sourcedb.has_spec("flict-floct")
assert self.sourcedb.has_spec("ethtool")
assert not self.sourcedb.has_spec("hedehodo")
def testGetSpec(self):
spec = self.sourcedb.get_spec("vlock")
assert spec.source.name == "vlock"
assert spec.source.partOf == "util"
spec = self.sourcedb.get_spec("ethtool")
assert spec.source.name == "ethtool"
assert spec.source.partOf == "applications.network"
def testGetSpecOfRepository(self):
spec = self.sourcedb.get_spec("dialog", "repo1")
assert spec.source.name == "dialog"
assert spec.source.partOf == "util"
spec = self.sourcedb.get_spec("ethtool", "repo1-src")
assert spec.source.name == "ethtool"
assert spec.source.partOf == "applications.network"
def testGetSpecAndRepository(self):
spec, repo = self.sourcedb.get_spec_repo("pv")
assert spec.source.name == "pv"
assert spec.source.partOf == "util"
assert repo == "repo1"
spec, repo = self.sourcedb.get_spec_repo("ethtool")
assert spec.source.name == "ethtool"
assert spec.source.partOf == "applications.network"
assert repo == "repo1-src"
def testGetSourceFromPackage(self):
# FIXME: Add multi package from source to createrepo.py
pkg = self.sourcedb.pkgtosrc("run-parts")
assert pkg == "runparts"
pkg = self.sourcedb.pkgtosrc("cracklib")
assert pkg == "cracklib"
def testSearchPackage(self):
packages = self.sourcedb.search_spec(["open", "ssl"])
assert set(["openssl"]) == set(packages)
packages = self.sourcedb.search_spec(["liblo", "!ouis"], repo="repo1")
assert set(["liblouis"]) == set(packages)
packages = self.sourcedb.search_spec(["bogo", "filter"], repo="repo1-src")
assert set(["bogofilter"]) == set(packages)
......@@ -7,7 +7,7 @@ class TestCase(unittest.TestCase):
def setUp(self):
options = inary.config.Options()
options.destdir = '../repos/tmp'
options.destdir = 'repos/tmp'
inary.api.set_options(options)
inary.api.set_scom(False)
......@@ -15,9 +15,9 @@ class TestCase(unittest.TestCase):
ctx.config.values.general.distribution_release = "2018"
if not inary.api.list_repos():
inary.api.add_repo("repo1", "../repos/repo1-bin/inary-index.xml")
inary.api.add_repo("repo2", "../repos/repo2-bin/inary-index.xml")
inary.api.add_repo("repo1-src", "../repos/repo1/inary-index.xml")
inary.api.add_repo("repo1", "repos/repo1-bin/inary-index.xml")
inary.api.add_repo("repo2", "repos/repo2-bin/inary-index.xml")
inary.api.add_repo("repo1-src", "repos/repo1/inary-index.xml")
inary.api.update_repo("repo1")
inary.api.update_repo("repo2")
inary.api.update_repo("repo1-src")
......@@ -11,7 +11,7 @@ from os.path import join, exists
class ArchiveTestCase(unittest.TestCase):
def testTarUnpack(self):
spec = SpecFile('../repos/repo1/system/base/bash/pspec.xml')
spec = SpecFile('repos/repo1/system/base/bash/pspec.xml')
targetDir = '/tmp/tests'
archives = sourcearchive.SourceArchives(spec)
archives.unpack(targetDir)
......@@ -20,7 +20,7 @@ class ArchiveTestCase(unittest.TestCase):
def testUnpackTarCond(self):
spec = SpecFile('../repos/repo1/system/devel/xorg-util/pspec.xml')
spec = SpecFile('repos/repo1/system/base/zlib/pspec.xml')
targetDir = '/tmp'
archives = sourcearchive.SourceArchives(spec)
for archive in spec.source.archive:
......@@ -32,7 +32,7 @@ class ArchiveTestCase(unittest.TestCase):
assert archive.type == 'tarbz2'
def testZipUnpack(self):
spec = SpecFile('../repos/repo1/multimedia/converter/uif2iso/pspec.xml')
spec = SpecFile('repos/repo1/applications/network/bogofilter/pspec.xml')
targetDir = '/tmp/tests'
archives = sourcearchive.SourceArchives(spec)
archives.fetch()
......@@ -40,7 +40,7 @@ class ArchiveTestCase(unittest.TestCase):
assert not exists(targetDir + '/openssl')
def testMakeZip(self):
spec = SpecFile('../repos/repo1/multimedia/converter/uif2iso/pspec.xml')
spec = SpecFile('repos/repo1/applications/network/gsl/pspec.xml')
targetDir = '/tmp/tests'
archives = sourcearchive.SourceArchives(spec)
archives.fetch(interactive = False)
......
......@@ -9,21 +9,21 @@ class FileTestCase(unittest.TestCase):
unittest.TestCase.setUp(self)
def testMakeUri(self):
spec = SpecFile("../repos/repo1/system/base/bash/pspec.xml")
spec = SpecFile("repos/repo1/system/base/bash/pspec.xml")
url = uri.URI(spec.source.archive[0].uri)
self.assertTrue(File.make_uri(url))
def testChooseMethod(self):
compress = File('../repos/repo2/inary-index.xml', File.read)
compress = File('repos/repo2/inary-index.xml', File.read)
self.assertTrue(File.choose_method('inary.conf', compress))
def testDecompress(self):
localfile = File('../repos/repo1/system/base/bash/pspec.xml', File.read)
compress = File('../repos/repo2/inary-index.xml', File.read)
localfile = File('repos/repo1/system/base/bash/pspec.xml', File.read)
compress = File('repos/repo2/inary-index.xml', File.read)
self.assertTrue(File.decompress(localfile,compress))
def testLocalFile(self):
f = File('../repos/repo1/system/base/curl/pspec.xml', File.read)
f = File('repos/repo1/system/base/curl/pspec.xml', File.read)
r = f.readlines()
assert (len(r) > 0)
......
......@@ -5,23 +5,23 @@ from inary.data.specfile import SpecFile
class SourceArchiveTestCase(unittest.TestCase):
def testFetch(self):
spec = SpecFile('../repos/repo1/system/base/bash/pspec.xml')
spec = SpecFile('repos/repo1/system/base/bash/pspec.xml')
srcarch = inary.sourcearchive.SourceArchive(spec.source.archive[0])
self.assertTrue(not srcarch.fetch())
def testIscached(self):
spec = SpecFile('../repos/repo1/system/base/bash/pspec.xml')
spec = SpecFile('repos/repo1/system/base/bash/pspec.xml')
srcarch = inary.sourcearchive.SourceArchive(spec.source.archive[0])
assert srcarch.is_cached()
def testIscached(self):
spec = SpecFile('../repos/repo1/system/base/bash/pspec.xml')
spec = SpecFile('repos/repo1/system/base/bash/pspec.xml')
targetDir = '/tmp/tests'
srcarch = inary.sourcearchive.SourceArchive(spec.source.archive[0])
self.assertTrue(not srcarch.unpack(targetDir))
def testUnpack(self):
spec = SpecFile('../repos/repo1/system/base/bash/pspec.xml')
spec = SpecFile('repos/repo1/system/base/bash/pspec.xml')
targetDir = '/tmp/tests'
srcarch = inary.sourcearchive.SourceArchive(spec.source.archive[0])
srcarch.unpack(targetDir)
tar cvf helloworld.tar helloworld
tar cjvf helloworld.tar.bz2 helloworld
tar cjvf helloworld.tar.gz helloworld
tar cjvf helloworld.tar.xz helloworld
......@@ -37,9 +37,9 @@ class ConfigFileTestCase(unittest.TestCase):
def testInaryConfValues(self):
cf = self.cf
self.assertEqual(cf.dirs.kde_dir, '/usr/')
self.assertEqual(cf.dirs.kde_dir, '/usr/kde/5')
self.assertEqual(cf.dirs.compiled_packages_dir, '/var/cache/inary/packages')
self.assertEqual(cf.general.architecture, 'x86_64')
self.assertEqual(cf.general.architecture, 'i686')
self.assertEqual(cf.general.distribution_release, '2018')
def testValuesExists(self):
......
......@@ -13,7 +13,7 @@ class FetchTestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.spec = SpecFile()
self.spec.read('../repos/repo1/system/base/openssl/pspec.xml')
self.spec.read('repos/repo1/system/base/openssl/pspec.xml')
self.url = uri.URI(self.spec.source.archive[0].uri)
self.url.set_auth_info(("user", "pass"))
self.destpath = ctx.config.archives_dir()
......
......@@ -10,8 +10,8 @@ class UtilTestCase(unittest.TestCase):
#process related functions
def testRunBatch(self):
assert (0, '', '') == run_batch('cd')
assert (127, '', '/bin/sh: add: command not found\n') == run_batch('add')
assert (0, b'', b'') == run_batch('cd')
assert (127, b'', b'/bin/sh: 1: add: not found\n') == run_batch('add')
def testRunLogged(self):
assert 0 == run_logged('ls')
......@@ -24,7 +24,7 @@ class UtilTestCase(unittest.TestCase):
#path processing functions tests
def testSplitPath(self):
assert ['usr', 'local', 'src'] == splitpath('usr/local/src')
assert ['usr', 'lib', 'sulin'] == splitpath('usr/lib/pardus')
assert ['usr', 'lib', 'sulin'] == splitpath('usr/lib/sulin')
def testSubPath(self):
self.assertTrue(subpath('usr','usr'))
......
<INARY>
<Source>
<Name>
popt
</Name>
<Packager>
<Name>
Kırmızı kafalar
</Name>
<Email>
hotmail@redhat.com
</Email>
</Packager>
</Source>
<Package>
<Name>
popt-libs
</Name>
<Summary>
Command line option parsing library
</Summary>
<Description>
library files for popt
</Description>
<License>
As-Is
</License>
<IsA>
library:util:optparser
</IsA>
<PartOf>
rpm:archive
</PartOf>
<RuntimeDependencies>
<Dependency>
gettext
</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="sharedLib">
/usr/lib
</Path>
<Path fileType="doc">
/usr/share/doc
</Path>
<Path fileType="doc">
/usr/share/man
</Path>
<Path fileType="localedata">
/usr/share/locale
</Path>
<Path fileType="header">
/usr/include/popt.h
</Path>
</Files>
<History>
<Update release="3">
<Date>2005-06-14</Date>
<Version>1.7</Version>
</Update>
<Update release="2">
<Date>2005-06-10</Date>
<Version>1.7</Version>
</Update>
<Update release="3">
<Date>2005-05-05</Date>
<Version>1.7</Version>
</Update>
</History>
<Build>
0
</Build>
<Distribution>
Pardus
</Distribution>
<DistributionRelease>
0.1
</DistributionRelease>
<Architecture>
Any
</Architecture>
<InstalledSize>
149691
</InstalledSize>
</Package>
</INARY>
......@@ -23,7 +23,6 @@ class ConflictTestCase(unittest.TestCase):
def testConflictCheck(self):
# In our sample repo1, inary.analyzer.conflicts with bar.
# If this fails, it may affect database test case results.
inary.api.add_repo("repo1", "../repos/repo1-bin/inary-index.xml")
inary.api.update_repo("repo1")
inary.api.install(["inary"])
......@@ -37,18 +36,14 @@ class ConflictTestCase(unittest.TestCase):
assert "inary" not in inary.api.list_installed()
inary.api.remove(["bar"])
inary.api.remove_repo("repo1")
def testInterRepoCrossConflicts(self):
#If this fails, it may affect database test case results
inary.api.add_repo("repo1", "../repos/repo1-bin/inary-index.xml")
inary.api.update_repo("repo1")
inary.api.install(["inary", "foo"])
before = inary.api.list_installed()
inary.api.remove_repo("repo1")
inary.api.add_repo("repo2", "../repos/repo2-bin/inary-index.xml")
inary.api.update_repo("repo2")
inary.api.upgrade(["inary"])
after = inary.api.list_installed()
......@@ -60,4 +55,3 @@ class ConflictTestCase(unittest.TestCase):
inary.api.remove(["foo"])
inary.api.remove(["inary"])
inary.api.remove_repo("repo2")
......@@ -15,5 +15,5 @@ class FilesTestCase(unittest.TestCase):
def testFiles(self):
self.files = inary.data.files.Files()
self.files.read('../repos/repo1/system/base/bash/pspec.xml')
self.files.read('repos/repo1/system/base/bash/pspec.xml')
......@@ -4,23 +4,16 @@ import inary.data.relation
class HistoryTestCase(unittest.TestCase):
def testCreate(self):
history = inary.history.History()
history = inary.data.history.History()
operation = 'upgrade'
history.create(operation)
history.create('install')
history.create('snapshot')
def testGetLatest(self):
history = inary.history.History()
history = inary.data.history.History()
history.read('history/001_upgrade.xml')
assert not '099' == history._get_latest()
history.read('history/002_remove.xml')
assert not '099' == history._get_latest()
......@@ -8,7 +8,7 @@ class MetadataTestCase(unittest.TestCase):
def testRead(self):
md = metadata.MetaData()
md.read("../addfiles/metadata.xml")
md.read("metadata.xml")
self.assertEqual(md.package.license,["As-Is"])
self.assertEqual(md.package.version,"1.7")
self.assertEqual(md.package.installedSize,149691)
......@@ -21,7 +21,7 @@ class MetadataTestCase(unittest.TestCase):
def testWrite(self):
md = self.testRead()
md.write("/tmp/metadata-write.xml")
md.write("repos/tmp/metadata-write.xml")
......@@ -6,11 +6,11 @@ import inary.util as util
class SpecFileTestCase(unittest.TestCase):
def setUp(self):
self.spec = specfile.SpecFile()
self.spec.read('../repos/repo1/system/base/ncurses/pspec.xml')
self.spec.read('repos/repo1/system/base/curl/pspec.xml')
def testGetSourceVersion(self):
assert '6.0' == self.spec.getSourceVersion()
assert '6.0' != self.spec.getSourceVersion()
assert '0.3' == self.spec.getSourceVersion()
def testGetSourceRelease(self):
assert '1' == self.spec.getSourceRelease()
......@@ -19,18 +19,5 @@ class SpecFileTestCase(unittest.TestCase):
self.fail()
def testCopy(self):
self.spec.read('../repos/repo1/system/base/ncurses/pspec.xml')
self.spec.write('../repos/repo1/system/base/ncurses/pspec.xml')
self.spec.read('repos/repo1/system/base/curl/pspec.xml')
self.spec.write('repos/repo1/system/base/curl/pspec.xml')
......@@ -74,13 +74,19 @@ componentTemplate = """
"""
actionsTemplate = """
from inary.actionsapi import spamtools
from inary.actionsapi import inarytools, cmaketools
WorkDir = "skeleton"
WorkDir = "helloworld"
def setup():
cmaketools.configure()
def build():
cmaketools.make()
def install():
inarytools.dobin("skeleton.py")
inarytools.rename("/usr/bin/skeleton.py", "%s")
autotools.install()
inarytools.rename("/usr/bin/helloworld", "%s")
"""
distributionTemplate = """
......@@ -138,8 +144,8 @@ class Package:
packager_email = "developers@sulin.org"
summary = "%s is a test package" % self.name
description = "%s is a test package for testing repositories." % self.name
sha1sum = "cc64dfa6e068fe1f6fb68a635878b1ea21acfac7"
archive = "http://dev.sulin.org/inary/skeleton.tar.gz"
sha1sum = "650ff7153aaec65aef71563068154617ca8913d0"
archive = "http://localhost/helloworld.tar.xz"
date = time.strftime("%Y-%m-%d")
partof = self.partof
......@@ -226,7 +232,6 @@ class Repo1(Repository):
self.packages = [
# system.base
pf.getPackage("liblouis", [], "desktop.accessibility"),
pf.getPackage("bash"),
pf.getPackage("curl", ["libidn", "zlib", "openssl"]),
pf.getPackage("shadow", ["db4","pam", "cracklib"]),
......@@ -235,19 +240,11 @@ class Repo1(Repository):
pf.getPackage("ncftp", [], "applications.network"),
pf.getPackage("bogofilter", ["gsl"], "applications.network"),
pf.getPackage("gsl", [], "applications.network"),
# multimedia
pf.getPackage("uif2iso", [], "multimedia.converter"),
pf.getPackage("jpeg", [], "multimedia.graphics"),
pf.getPackage("dialog", [], "util"),
pf.getPackage("vlock", [], "util"),
pf.getPackage("pv", [], "util"),
pf.getPackage("tidy", [], "util")
pf.getPackage("jpeg"),
]
# system.base
self.packages.extend(pf.getPackageBundle("system.base", "ca-certificates", "libidn", "zlib", "openssl", "db4", "pam", "run-parts" "cracklib", "ncurses", "zlib"))
self.packages.extend(pf.getPackageBundle("system.base", "libidn", "zlib", "openssl", "db4", "pam", "cracklib"))
# applications.network
self.packages.extend(pf.getPackageBundle("applications.network", "ethtool", "nfdump"))
......@@ -268,11 +265,6 @@ class Repo2(Repository):
pf.getPackage("ctorrent", ["openssl"], "applications.network"),
pf.getPackage("lft", ["libpcap"], "applications.network"),
pf.getPackage("libpcap", [], "applications.network"),
pf.getPackage("inxi", [], "util.admin"),
pf.getPackage("dialog", [], "util.misc"),
pf.getPackage("lsof", [], "util.misc"),
pf.getPackage("most", [], "util.misc")
]
......@@ -294,7 +286,7 @@ class BuildFarm:
os.mkdir(binrepo)
for root, dirs, files in os.walk(repo):
if "pspec.xml" in files:
os.system("inary-cli build %s/%s -O %s" % (root, "pspec.xml", binrepo))
os.system("inary-cli build %s/%s -O %s --ignore-safety --ignore-dep --package" % (root, "pspec.xml", binrepo))
self.create_index(repo)
if __name__ == "__main__":
......
Add zlib tarbz2 typed sourcearchive
Add bash targz typed sourcearchive
......@@ -13,15 +13,16 @@ import os
import time
from inary import version
import inary.constants as constant
from inary.oo import *
from inary.util import Singleton
class OOTestCase(unittest.TestCase):
def setUp(self):
pass
def testautosuper(self):
class A:
__metaclass__ = autosuper
def testAutosuper(self):
class A(metaclass = autosuper):
def meth(self):
return "A"
class B(A):
......@@ -33,12 +34,11 @@ class OOTestCase(unittest.TestCase):
class D(C, B):
def meth(self):
return "D" + self.__super.meth()
self.assert_( D().meth() == "DCBA" )
def testconstant(self):
class A:
__metaclass__ = constant
def testConstant(self):
class A(metaclass = constant._constant):
def __init__(self):
self.a = 1
self.b = 2
......@@ -50,30 +50,13 @@ class OOTestCase(unittest.TestCase):
passed = True
self.assert_(passed)
def testsingleton(self):
class A:
__metaclass__ = singleton
def testSingleton(self):
class A(metaclass = Singleton):
def __init__(self):
self.a = time.time()
a1 = A()
a2 = A()
self.assert_(a1 is a2)
def testconstantsingleton(self):
class A:
__metaclass__ = constantsingleton
def __init__(self):
self.a = 1
self.b = 2
mya = A()
try:
passed = False
mya.a = 0
except ConstError as e:
passed = True
self.assert_(passed)
self.assertEqual(mya.a, 1)
mya2 = A()
self.assert_(mya is mya2)
suite = unittest.makeSuite(OOTestCase)
......@@ -5,14 +5,14 @@ from inary.data import pgraph
class GraphTestCase(unittest.TestCase):
def setUp(self):
self.g0 = inary.pgraph.Digraph()
self.g0 = pgraph.Digraph()
self.g0.add_edge(1,2)
self.g0.add_edge(1,3)
self.g0.add_edge(2,3)
self.g0.add_edge(3,4)
self.g0.add_edge(4,1)
self.g1 = inary.pgraph.Digraph()
self.g1 = pgraph.Digraph()
self.g1.add_edge(0,2)
self.g1.add_edge(0,3)
self.g1.add_edge(2,4)
......
......@@ -11,7 +11,6 @@
import unittest
import os
import types
import inary
import inary.api
......@@ -23,41 +22,41 @@ class AutoXmlTestCase(unittest.TestCase):
def setUp(self):
class OtherInfo:
__metaclass__ = autoxml.autoxml
t_StartDate = [types.StringType, autoxml.mandatory]
t_Interest = [types.StringType, autoxml.optional]
t_Tith = [ [types.UnicodeType], autoxml.optional, 'Tith/Person']
class OtherInfo(metaclass = autoxml.autoxml):
t_StartDate = [str, autoxml.mandatory]
t_Interest = [str, autoxml.optional]
t_Tith = [ [bytes], autoxml.optional, 'Tith/Person']
class Rat(xmlfile.XmlFile):
__metaclass__ = autoxml.autoxml
t_Name = [types.UnicodeType, autoxml.mandatory]
class Rat(xmlfile.XmlFile, metaclass = autoxml.autoxml):
t_Name = [bytes, autoxml.mandatory]
t_Description = [autoxml.LocalText, autoxml.mandatory]
t_Number = [types.IntType, autoxml.optional]
t_Email = [types.StringType, autoxml.optional]
a_href = [types.StringType, autoxml.mandatory]
t_Dreams = [ [types.StringType], autoxml.mandatory, 'Dreams']
t_Heality = [ Heality, autoxml.optional ]
t_Number = [int, autoxml.optional]
t_Email = [str, autoxml.optional]
a_href = [str, autoxml.mandatory]
t_Dreams = [ [str], autoxml.mandatory, 'Dreams']
t_Heality = [ str, autoxml.optional ]
s_Comment = [ autoxml.Text, autoxml.mandatory]
a_otherInfo = [OtherInfo, autoxml.mandatory]
self.Rat = Rat
def testDeclaration(self):
self.assertEqual(len(self.Rat.decoders), 3) # Decoders not work well
self.assertEqual(len(self.Rat.decoders), 8) # Decoders not work well
self.assert_(hasattr(self.Rat, 'encode'))
def testReadWrite(self):
a = self.Lat()
a = self.Rat()
# test initializer
self.assertEqual(a.href, None)
# test read
a.read('tests/lat.xml')
a.read('tests/rat.xml')
self.assert_(a.href.startswith('http://www.su'))
self.assertEqual(a.number, 911)
self.assertEqual(a.name, u'Inary Testers')
self.assertEqual(len(a.dreams), 2)
self.assertEqual(a.name, 'Inary Testers')
self.assertEqual(len(a.dreams), 3)
self.assertEqual(len(a.heality.tith), 100)
self.assert_(not a.errors())
......@@ -73,7 +72,7 @@ class AutoXmlTestCase(unittest.TestCase):
a.number = 911
a.email = "admins@sulin.org"
a.description['tr'] = 'inary tester ekibi'
a.comment = u'Sozde test ekibi her seyi ben yapiom'
a.comment = b'Sozde test ekibi her seyi ben yapiom'
a.href = 'http://www.sulin.orf/'
a.otherInfo.startDate = '01012018'
a.dreams = [ 'will', 'be', 'hero' ]
......@@ -94,7 +93,7 @@ class LocalTextTestCase(unittest.TestCase):
self.a = a
def testStr(self):
s = unicode(self.a)
s = bytes(self.a)
self.assert_(s!= None and len(s)>=6)
suite1 = unittest.makeSuite(AutoXmlTestCase)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment