From c798db8056a17145ec806e0baf3fea5500f35ead Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 27 Apr 2017 18:58:15 +0300 Subject: [PATCH] Add system's requirements.txt, enforce flake8 linter Fix style issues in functional tests. --- .gitignore | 2 + .travis.yml | 1 - Makefile | 12 +++- system/api_lib.py | 6 +- system/fs_endpoint_lib.py | 6 +- system/lib.py | 9 +-- system/requirements.txt | 5 ++ system/run.py | 94 +++++++++++++++++-------------- system/t02_config/__init__.py | 3 +- system/t03_help/__init__.py | 6 +- system/t04_mirror/__init__.py | 9 --- system/t04_mirror/create.py | 41 ++++++++++---- system/t04_mirror/search.py | 12 ++-- system/t04_mirror/show.py | 8 ++- system/t04_mirror/update.py | 16 ++++-- system/t05_snapshot/__init__.py | 12 ---- system/t05_snapshot/diff.py | 13 +++-- system/t05_snapshot/pull.py | 20 ++++--- system/t05_snapshot/search.py | 13 +++-- system/t05_snapshot/show.py | 8 ++- system/t06_publish/__init__.py | 11 ---- system/t06_publish/fs_endpoint.py | 2 - system/t06_publish/repo.py | 8 ++- system/t06_publish/snapshot.py | 4 +- system/t06_publish/switch.py | 4 +- system/t07_serve/__init__.py | 6 +- system/t08_db/__init__.py | 3 - system/t09_repo/__init__.py | 14 ----- system/t09_repo/add.py | 38 +++++++++---- system/t09_repo/create.py | 3 +- system/t09_repo/edit.py | 3 +- system/t09_repo/include.py | 74 ++++++++++++++++++------ system/t09_repo/remove.py | 1 - system/t09_repo/search.py | 13 +++-- system/t10_task/__init__.py | 2 - system/t11_package/__init__.py | 3 - system/t11_package/search.py | 13 +++-- system/t11_package/show.py | 16 ++++-- system/t12_api/__init__.py | 10 ---- system/t12_api/graph.py | 8 +-- system/t12_api/packages.py | 10 ++-- system/t12_api/publish.py | 24 ++++---- system/t12_api/repos.py | 27 +++++---- system/t12_api/snapshots.py | 1 - 44 files changed, 334 insertions(+), 260 deletions(-) create mode 100644 system/requirements.txt diff --git a/.gitignore b/.gitignore index d6ec8f91..44f78d10 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ man/aptly.1.html man/aptly.1.ronn .goxc.local.json + +system/env/ diff --git a/.travis.yml b/.travis.yml index bb4015d3..7c23b2f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,6 @@ before_install: - . env/bin/activate - pip install six packaging appdirs - pip install -U pip setuptools - - pip install boto requests requests-unixsocket python-swiftclient - mkdir -p $GOPATH/src/github.com/smira - ln -s $TRAVIS_BUILD_DIR $GOPATH/src/github.com/smira || true - cd $GOPATH/src/github.com/smira/aptly diff --git a/Makefile b/Makefile index 03b354e3..3eaca1b9 100644 --- a/Makefile +++ b/Makefile @@ -35,16 +35,22 @@ coverage: coverage.out go tool cover -html=coverage.out rm -f coverage.out -check: +check: system/env gometalinter --vendor --vendored-linters --config=linter.json ./... + . system/env/bin/activate && flake8 --max-line-length=200 --exclude=env/ system/ install: go install -v -ldflags "-X main.Version=$(VERSION)" -system-test: install +system/env: system/requirements.txt + rm -rf system/env + virtualenv system/env + system/env/bin/pip install -r system/requirements.txt + +system-test: install system/env if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi - APTLY_VERSION=$(VERSION) PATH=$(BINPATH)/:$(PATH) $(PYTHON) system/run.py --long $(TESTS) + . system/env/bin/activate && APTLY_VERSION=$(VERSION) PATH=$(BINPATH)/:$(PATH) $(PYTHON) system/run.py --long $(TESTS) travis: $(TRAVIS_TARGET) check system-test diff --git a/system/api_lib.py b/system/api_lib.py index a585be8f..bb54ef0f 100644 --- a/system/api_lib.py +++ b/system/api_lib.py @@ -42,7 +42,7 @@ class APITest(BaseTest): def post(self, uri, *args, **kwargs): if "json" in kwargs: kwargs["data"] = json.dumps(kwargs.pop("json")) - if not "headers" in kwargs: + if "headers" not in kwargs: kwargs["headers"] = {} kwargs["headers"]["Content-Type"] = "application/json" return requests.post("http://%s%s" % (self.base_url, uri), *args, **kwargs) @@ -50,7 +50,7 @@ class APITest(BaseTest): def put(self, uri, *args, **kwargs): if "json" in kwargs: kwargs["data"] = json.dumps(kwargs.pop("json")) - if not "headers" in kwargs: + if "headers" not in kwargs: kwargs["headers"] = {} kwargs["headers"]["Content-Type"] = "application/json" return requests.put("http://%s%s" % (self.base_url, uri), *args, **kwargs) @@ -58,7 +58,7 @@ class APITest(BaseTest): def delete(self, uri, *args, **kwargs): if "json" in kwargs: kwargs["data"] = json.dumps(kwargs.pop("json")) - if not "headers" in kwargs: + if "headers" not in kwargs: kwargs["headers"] = {} kwargs["headers"]["Content-Type"] = "application/json" return requests.delete("http://%s%s" % (self.base_url, uri), *args, **kwargs) diff --git a/system/fs_endpoint_lib.py b/system/fs_endpoint_lib.py index 53600c87..dcb4e803 100644 --- a/system/fs_endpoint_lib.py +++ b/system/fs_endpoint_lib.py @@ -1,13 +1,14 @@ import os from lib import BaseTest + class FileSystemEndpointTest(BaseTest): """ BaseTest + support for filesystem endpoints """ def prepare(self): - self.configOverride = { "FileSystemPublishEndpoints": { + self.configOverride = {"FileSystemPublishEndpoints": { "symlink": { "rootDir": os.path.join(os.environ["HOME"], ".aptly", "public_symlink"), "linkMethod": "symlink" @@ -29,7 +30,6 @@ class FileSystemEndpointTest(BaseTest): }} super(FileSystemEndpointTest, self).prepare() - def check_is_regular(self, path): if not os.path.isfile(os.path.join(os.environ["HOME"], ".aptly", path)): raise Exception("path %s is not a regular file" % (path, )) @@ -44,5 +44,5 @@ class FileSystemEndpointTest(BaseTest): def check_is_copy(self, path): fullpath = os.path.join(os.environ["HOME"], ".aptly", path) - if not ( os.path.isfile(fullpath) and not self.check_is_hardlink(path) ): + if not (os.path.isfile(fullpath) and not self.check_is_hardlink(path)): raise Exception("path %s is not a copy" % (path, )) diff --git a/system/lib.py b/system/lib.py index 928109f2..b23d15d1 100644 --- a/system/lib.py +++ b/system/lib.py @@ -13,7 +13,6 @@ import shutil import string import threading import urllib -#import time import pprint import SocketServer import SimpleHTTPServer @@ -118,19 +117,15 @@ class BaseTest(object): def prepare_fixture(self): if self.fixturePool: - #start = time.time() os.makedirs(os.path.join(os.environ["HOME"], ".aptly"), 0755) os.symlink(self.fixturePoolDir, os.path.join(os.environ["HOME"], ".aptly", "pool")) - #print "FIXTURE POOL: %.2f" % (time.time()-start) if self.fixturePoolCopy: os.makedirs(os.path.join(os.environ["HOME"], ".aptly"), 0755) shutil.copytree(self.fixturePoolDir, os.path.join(os.environ["HOME"], ".aptly", "pool"), ignore=shutil.ignore_patterns(".git")) if self.fixtureDB: - #start = time.time() shutil.copytree(self.fixtureDBDir, os.path.join(os.environ["HOME"], ".aptly", "db")) - #print "FIXTURE DB: %.2f" % (time.time()-start) if self.fixtureWebServer: self.webServerUrl = self.start_webserver(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), @@ -172,10 +167,8 @@ class BaseTest(object): def run_cmd(self, command, expected_code=0): try: - #start = time.time() proc = self._start_process(command, stdout=subprocess.PIPE) output, _ = proc.communicate() - #print "CMD %s: %.2f" % (" ".join(command), time.time()-start) if proc.returncode != expected_code: raise Exception("exit code %d != %d (output: %s)" % (proc.returncode, expected_code, output)) return output @@ -279,7 +272,7 @@ class BaseTest(object): raise Exception("%s is not greater to %s" % (a, b)) def check_in(self, item, l): - if not item in l: + if item not in l: raise Exception("item %r not in %r", item, l) def check_subset(self, a, b): diff --git a/system/requirements.txt b/system/requirements.txt new file mode 100644 index 00000000..b9847875 --- /dev/null +++ b/system/requirements.txt @@ -0,0 +1,5 @@ +boto +requests +requests-unixsocket +python-swiftclient +flake8 diff --git a/system/run.py b/system/run.py index b107152b..cff526cb 100755 --- a/system/run.py +++ b/system/run.py @@ -22,6 +22,16 @@ except ImportError: return s +def walk_modules(package): + yield importlib.import_module(package) + for name in glob.glob(package + "/*.py"): + name = os.path.splitext(os.path.basename(name))[0] + if name == "__init__": + continue + + yield importlib.import_module(package + "." + name) + + def run(include_long_tests=False, capture_results=False, tests=None, filters=None): """ Run system test. @@ -33,54 +43,52 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non lastBase = None for test in tests: + for testModule in walk_modules(test): + for name in dir(testModule): + o = getattr(testModule, name) - testModule = importlib.import_module(test) - - for name in dir(testModule): - o = getattr(testModule, name) - - if not (inspect.isclass(o) and issubclass(o, BaseTest) and o is not BaseTest and - o is not SwiftTest and o is not S3Test and o is not APITest and o is not FileSystemEndpointTest): - continue - - newBase = o.__bases__[0] - if lastBase is not None and lastBase is not newBase: - lastBase.shutdown_class() - - lastBase = newBase - - if filters: - matches = False - - for filt in filters: - if fnmatch.fnmatch(o.__name__, filt): - matches = True - break - - if not matches: + if not (inspect.isclass(o) and issubclass(o, BaseTest) and o is not BaseTest and + o is not SwiftTest and o is not S3Test and o is not APITest and o is not FileSystemEndpointTest): continue - t = o() - if t.longTest and not include_long_tests or not t.fixture_available(): - numSkipped += 1 - continue + newBase = o.__bases__[0] + if lastBase is not None and lastBase is not newBase: + lastBase.shutdown_class() - numTests += 1 + lastBase = newBase - sys.stdout.write("%s:%s... " % (test, o.__name__)) + if filters: + matches = False - try: - t.captureResults = capture_results - t.test() - except BaseException: - numFailed += 1 - typ, val, tb = sys.exc_info() - fails.append((test, t, typ, val, tb, testModule)) - sys.stdout.write(colored("FAIL\n", color="red")) - else: - sys.stdout.write(colored("OK\n", color="green")) + for filt in filters: + if fnmatch.fnmatch(o.__name__, filt): + matches = True + break - t.shutdown() + if not matches: + continue + + t = o() + if t.longTest and not include_long_tests or not t.fixture_available(): + numSkipped += 1 + continue + + numTests += 1 + + sys.stdout.write("%s:%s... " % (test, o.__name__)) + + try: + t.captureResults = capture_results + t.test() + except BaseException: + numFailed += 1 + typ, val, tb = sys.exc_info() + fails.append((test, t, typ, val, tb, testModule)) + sys.stdout.write(colored("FAIL\n", color="red")) + else: + sys.stdout.write(colored("OK\n", color="green")) + + t.shutdown() if lastBase is not None: lastBase.shutdown_class() @@ -91,13 +99,13 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non print "\nFAILURES (%d):" % (len(fails), ) for (test, t, typ, val, tb, testModule) in fails: - print "%s:%s %s" % (test, t.__class__.__name__, testModule.__doc__.strip() + ": " + t.__doc__.strip()) - #print "ERROR: %s" % (val, ) + print "%s:%s %s" % (test, t.__class__.__name__, getattr(testModule, "__doc__", "").strip() + ": " + t.__doc__.strip()) traceback.print_exception(typ, val, tb) print "=" * 60 sys.exit(1) + if __name__ == "__main__": if 'APTLY_VERSION' not in os.environ: try: diff --git a/system/t02_config/__init__.py b/system/t02_config/__init__.py index 9d5120ee..240e5944 100644 --- a/system/t02_config/__init__.py +++ b/system/t02_config/__init__.py @@ -45,7 +45,8 @@ class ConfigInFileTest(BaseTest): "-config=%s" % (os.path.join(os.path.dirname(inspect.getsourcefile(BadConfigTest)), "aptly.conf"), )] prepare = BaseTest.prepare_remove_all - outputMatchPrepare = lambda _, s: re.sub(r' -(cpuprofile|memprofile|memstats|meminterval)=.*\n', '', s, flags=re.MULTILINE) + def outputMatchPrepare(_, s): + return re.sub(r' -(cpuprofile|memprofile|memstats|meminterval)=.*\n', '', s, flags=re.MULTILINE) class ConfigInMissingFileTest(BaseTest): diff --git a/system/t03_help/__init__.py b/system/t03_help/__init__.py index 91ee41a6..07f1f828 100644 --- a/system/t03_help/__init__.py +++ b/system/t03_help/__init__.py @@ -13,7 +13,8 @@ class MainTest(BaseTest): expectedCode = 2 runCmd = "aptly" - outputMatchPrepare = lambda _, s: re.sub(r' -(cpuprofile|memprofile|memstats|meminterval)=.*\n', '', s, flags=re.MULTILINE) + def outputMatchPrepare(_, s): + return re.sub(r' -(cpuprofile|memprofile|memstats|meminterval)=.*\n', '', s, flags=re.MULTILINE) class MirrorTest(BaseTest): @@ -38,7 +39,8 @@ class MainHelpTest(BaseTest): """ runCmd = "aptly help" - outputMatchPrepare = lambda _, s: re.sub(r' -(cpuprofile|memprofile|memstats|meminterval)=.*\n', '', s, flags=re.MULTILINE) + def outputMatchPrepare(_, s): + return re.sub(r' -(cpuprofile|memprofile|memstats|meminterval)=.*\n', '', s, flags=re.MULTILINE) class MirrorHelpTest(BaseTest): diff --git a/system/t04_mirror/__init__.py b/system/t04_mirror/__init__.py index 1c2c36bf..b6995061 100644 --- a/system/t04_mirror/__init__.py +++ b/system/t04_mirror/__init__.py @@ -1,12 +1,3 @@ """ Testing mirror management """ - -from .create import * -from .show import * -from .list import * -from .update import * -from .drop import * -from .rename import * -from .edit import * -from .search import * diff --git a/system/t04_mirror/create.py b/system/t04_mirror/create.py index da73d60a..84bafa86 100644 --- a/system/t04_mirror/create.py +++ b/system/t04_mirror/create.py @@ -92,7 +92,9 @@ class CreateMirror9Test(BaseTest): """ runCmd = "aptly mirror create --keyring=aptlytest.gpg mirror9 http://mirror.yandex.ru/debian/ wheezy-backports" fixtureGpg = True - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using|Warning: using insecure memory!\n', '', s) + + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using|Warning: using insecure memory!\n', '', s) def check(self): def removeDates(s): @@ -109,9 +111,11 @@ class CreateMirror10Test(BaseTest): runCmd = "aptly mirror create --keyring=aptlytest.gpg mirror10 http://mirror.yandex.ru/debian-backports/ squeeze-backports" fixtureGpg = False gold_processor = BaseTest.expand_environ - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using|gpgv: keyblock resource .*$|gpgv: Can\'t check signature: .*$', '', s, flags=re.MULTILINE) expectedCode = 1 + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using|gpgv: keyblock resource .*$|gpgv: Can\'t check signature: .*$', '', s, flags=re.MULTILINE) + class CreateMirror11Test(BaseTest): """ @@ -119,7 +123,9 @@ class CreateMirror11Test(BaseTest): """ runCmd = "aptly mirror create --keyring=aptlytest.gpg mirror11 http://mirror.yandex.ru/debian/ wheezy" fixtureGpg = True - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using', '', s) def check(self): self.check_output() @@ -133,9 +139,11 @@ class CreateMirror12Test(BaseTest): runCmd = "aptly mirror create --keyring=aptlytest.gpg mirror12 http://mirror.yandex.ru/debian/ wheezy" fixtureGpg = False gold_processor = BaseTest.expand_environ - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using|gpgv: keyblock resource .*$|gpgv: Can\'t check signature: .*$', '', s, flags=re.MULTILINE) expectedCode = 1 + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using|gpgv: keyblock resource .*$|gpgv: Can\'t check signature: .*$', '', s, flags=re.MULTILINE) + class CreateMirror13Test(BaseTest): """ @@ -155,7 +163,9 @@ class CreateMirror14Test(BaseTest): """ runCmd = "aptly mirror create -keyring=aptlytest.gpg mirror14 https://cloud.r-project.org/bin/linux/debian jessie-cran3/" fixtureGpg = True - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using', '', s) def check(self): self.check_output() @@ -195,8 +205,6 @@ class CreateMirror18Test(BaseTest): create mirror: mirror with ppa URL """ fixtureGpg = True - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) - configOverride = { "ppaDistributorID": "ubuntu", "ppaCodename": "maverick", @@ -204,6 +212,9 @@ class CreateMirror18Test(BaseTest): runCmd = "aptly mirror create -keyring=aptlytest.gpg mirror18 ppa:gladky-anton/gnuplot" + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using', '', s) + def check(self): self.check_output() self.check_cmd_output("aptly mirror show mirror18", "mirror_show") @@ -214,10 +225,12 @@ class CreateMirror19Test(BaseTest): create mirror: mirror with / in distribution """ fixtureGpg = True - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) runCmd = "aptly -architectures='i386' mirror create -keyring=aptlytest.gpg -with-sources mirror19 http://security.debian.org/ wheezy/updates main" + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using', '', s) + def check(self): def removeDates(s): return re.sub(r"(Date|Valid-Until): [,0-9:+A-Za-z -]+\n", "", s) @@ -231,12 +244,14 @@ class CreateMirror20Test(BaseTest): create mirror: using failing HTTP_PROXY """ fixtureGpg = True - outputMatchPrepare = lambda _, s: s.replace('getsockopt: ', '').replace('proxyconnect tcp', 'http: error connecting to proxy http://127.0.0.1:3137') runCmd = "aptly -architectures='i386' mirror create -keyring=aptlytest.gpg -with-sources mirror20 http://security.debian.org/ wheezy/updates main" environmentOverride = {"HTTP_PROXY": "127.0.0.1:3137"} expectedCode = 1 + def outputMatchPrepare(_, s): + return s.replace('getsockopt: ', '').replace('proxyconnect tcp', 'http: error connecting to proxy http://127.0.0.1:3137') + class CreateMirror21Test(BaseTest): """ @@ -244,7 +259,9 @@ class CreateMirror21Test(BaseTest): """ runCmd = "aptly mirror create -keyring=aptlytest.gpg mirror21 http://pkg.jenkins-ci.org/debian-stable binary/" fixtureGpg = True - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using', '', s) def check(self): def removeSHA512(s): @@ -285,7 +302,9 @@ class CreateMirror24Test(BaseTest): """ runCmd = "aptly mirror create -ignore-signatures=false -keyring=aptlytest.gpg mirror24 http://security.debian.org/ wheezy/updates main" fixtureGpg = True - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + + def outputMatchPrepare(_, s): + return re.sub(r'Signature made .* using', '', s) configOverride = { "gpgDisableVerify": True diff --git a/system/t04_mirror/search.py b/system/t04_mirror/search.py index d67d8d98..3e91be2b 100644 --- a/system/t04_mirror/search.py +++ b/system/t04_mirror/search.py @@ -1,12 +1,16 @@ from lib import BaseTest +def sortLines(_, s): + return "\n".join(sorted(s.split("\n"))) + + class SearchMirror1Test(BaseTest): """ search mirror: regular search """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly mirror search wheezy-main '$$Architecture (i386), Name (% *-dev)'" @@ -32,7 +36,7 @@ class SearchMirror4Test(BaseTest): search mirror: with-deps search """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly mirror search -with-deps wheezy-main 'Name (nginx)'" @@ -41,7 +45,7 @@ class SearchMirror5Test(BaseTest): search mirror: regular search """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly mirror search -format='{{.Package}}#{{.Version}}' wheezy-main '$$Architecture (i386), Name (% *-dev)'" @@ -50,5 +54,5 @@ class SearchMirror6Test(BaseTest): search mirror: no query """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly mirror search -format='{{.Package}}#{{.Version}}' wheezy-main" diff --git a/system/t04_mirror/show.py b/system/t04_mirror/show.py index 51bfcd41..cd721ced 100644 --- a/system/t04_mirror/show.py +++ b/system/t04_mirror/show.py @@ -24,7 +24,9 @@ class ShowMirror3Test(BaseTest): """ fixtureDB = True runCmd = "aptly mirror show --with-packages wheezy-contrib" - outputMatchPrepare = lambda _, s: re.sub(r"Last update: [0-9:+A-Za-z -]+\n", "", s) + + def outputMatchPrepare(_, s): + return re.sub(r"Last update: [0-9:+A-Za-z -]+\n", "", s) class ShowMirror4Test(BaseTest): @@ -35,4 +37,6 @@ class ShowMirror4Test(BaseTest): "aptly mirror create -ignore-signatures -filter='nginx | Priority (required)' -filter-with-deps=true mirror4 http://security.debian.org/ wheezy/updates main" ] runCmd = "aptly mirror show mirror4" - outputMatchPrepare = lambda _, s: re.sub(r"(Date|Valid-Until): [,0-9:+A-Za-z -]+\n", "", s) + + def outputMatchPrepare(_, s): + return re.sub(r"(Date|Valid-Until): [,0-9:+A-Za-z -]+\n", "", s) diff --git a/system/t04_mirror/update.py b/system/t04_mirror/update.py index 94954368..1e93b597 100644 --- a/system/t04_mirror/update.py +++ b/system/t04_mirror/update.py @@ -6,6 +6,10 @@ import inspect from lib import BaseTest +def filterOutSignature(_, s): + return re.sub(r'Signature made .* using', '', s) + + class UpdateMirror1Test(BaseTest): """ update mirrors: regular update @@ -96,7 +100,7 @@ class UpdateMirror7Test(BaseTest): "aptly mirror create --keyring=aptlytest.gpg -architectures=amd64 flat https://cloud.r-project.org/bin/linux/debian jessie-cran3/", ] runCmd = "aptly mirror update --keyring=aptlytest.gpg flat" - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + outputMatchPrepare = filterOutSignature def output_processor(self, output): return "\n".join(sorted(output.split("\n"))) @@ -112,7 +116,7 @@ class UpdateMirror8Test(BaseTest): "aptly mirror create --keyring=aptlytest.gpg gnuplot-maverick-src http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick", ] runCmd = "aptly mirror update --keyring=aptlytest.gpg gnuplot-maverick-src" - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + outputMatchPrepare = filterOutSignature class UpdateMirror9Test(BaseTest): @@ -124,7 +128,7 @@ class UpdateMirror9Test(BaseTest): "aptly mirror create --keyring=aptlytest.gpg -with-sources flat-src https://cloud.r-project.org/bin/linux/debian jessie-cran3/", ] runCmd = "aptly mirror update --keyring=aptlytest.gpg flat-src" - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + outputMatchPrepare = filterOutSignature def output_processor(self, output): return "\n".join(sorted(output.split("\n"))) @@ -139,7 +143,7 @@ class UpdateMirror10Test(BaseTest): "aptly mirror create -keyring=aptlytest.gpg -with-sources -filter='!(Name (% r-*)), !($$PackageType (source))' flat-src https://cloud.r-project.org/bin/linux/debian jessie-cran3/", ] runCmd = "aptly mirror update --keyring=aptlytest.gpg flat-src" - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + outputMatchPrepare = filterOutSignature def output_processor(self, output): return "\n".join(sorted(output.split("\n"))) @@ -154,7 +158,7 @@ class UpdateMirror11Test(BaseTest): fixtureCmds = [ "aptly mirror create -keyring=aptlytest.gpg -filter='Priority (required), Name (% s*)' -architectures=i386 wheezy-main ftp://ftp.ru.debian.org/debian/ wheezy main", ] - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + outputMatchPrepare = filterOutSignature runCmd = "aptly mirror update -keyring=aptlytest.gpg wheezy-main" def output_processor(self, output): @@ -171,7 +175,7 @@ class UpdateMirror12Test(BaseTest): "aptly -architectures=i386,amd64 mirror create -keyring=aptlytest.gpg -filter='$$Source (gnupg)' -with-udebs wheezy http://mirror.yandex.ru/debian/ wheezy main non-free", ] runCmd = "aptly mirror update -keyring=aptlytest.gpg wheezy" - outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + outputMatchPrepare = filterOutSignature def output_processor(self, output): return "\n".join(sorted(output.split("\n"))) diff --git a/system/t05_snapshot/__init__.py b/system/t05_snapshot/__init__.py index 4e1995e9..8a0897d6 100644 --- a/system/t05_snapshot/__init__.py +++ b/system/t05_snapshot/__init__.py @@ -1,15 +1,3 @@ """ Testing snapshot management """ - -from .create import * -from .show import * -from .list import * -from .verify import * -from .pull import * -from .diff import * -from .merge import * -from .drop import * -from .rename import * -from .search import * -from .filter import * \ No newline at end of file diff --git a/system/t05_snapshot/diff.py b/system/t05_snapshot/diff.py index 570c3047..c1980749 100644 --- a/system/t05_snapshot/diff.py +++ b/system/t05_snapshot/diff.py @@ -2,6 +2,10 @@ import re from lib import BaseTest +def trimTrailingWhitespace(_, s): + return re.sub(r'\s*$', '', s, flags=re.MULTILINE) + + class DiffSnapshot1Test(BaseTest): """ diff two snapshots: normal diff @@ -13,8 +17,7 @@ class DiffSnapshot1Test(BaseTest): "aptly snapshot pull snap1 snap2 snap3 'rsyslog (>= 7.4.4)'" ] runCmd = "aptly snapshot diff snap1 snap3" - # trim trailing whitespace - outputMatchPrepare = lambda _, s: re.sub(r'\s*$', '', s, flags=re.MULTILINE) + outputMatchPrepare = trimTrailingWhitespace class DiffSnapshot2Test(BaseTest): @@ -27,8 +30,7 @@ class DiffSnapshot2Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-backports", ] runCmd = "aptly snapshot diff snap1 snap2" - # trim trailing whitespace - outputMatchPrepare = lambda _, s: re.sub(r'\s*$', '', s, flags=re.MULTILINE) + outputMatchPrepare = trimTrailingWhitespace class DiffSnapshot3Test(BaseTest): @@ -41,8 +43,7 @@ class DiffSnapshot3Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-backports", ] runCmd = "aptly snapshot diff -only-matching snap1 snap2" - # trim trailing whitespace - outputMatchPrepare = lambda _, s: re.sub(r'\s*$', '', s, flags=re.MULTILINE) + outputMatchPrepare = trimTrailingWhitespace class DiffSnapshot4Test(BaseTest): diff --git a/system/t05_snapshot/pull.py b/system/t05_snapshot/pull.py index dc2a1343..d5146dcb 100644 --- a/system/t05_snapshot/pull.py +++ b/system/t05_snapshot/pull.py @@ -2,6 +2,10 @@ from lib import BaseTest import re +def sortLines(_, output): + return "\n".join(sorted(output.split("\n"))) + + class PullSnapshot1Test(BaseTest): """ pull snapshot: simple conditions @@ -12,7 +16,7 @@ class PullSnapshot1Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-non-free", ] runCmd = "aptly snapshot pull snap1 snap2 snap3 mame unrar" - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines def check(self): def remove_created_at(s): @@ -32,7 +36,7 @@ class PullSnapshot2Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-backports", ] runCmd = "aptly snapshot pull snap1 snap2 snap3 'rsyslog (>= 7.4.4)'" - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines def check(self): def remove_created_at(s): @@ -52,7 +56,7 @@ class PullSnapshot3Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-backports", ] runCmd = "aptly snapshot pull -no-deps snap1 snap2 snap3 'rsyslog (>= 7.4.4)'" - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines def check(self): def remove_created_at(s): @@ -72,7 +76,7 @@ class PullSnapshot4Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-backports", ] runCmd = "aptly snapshot pull -dry-run snap1 snap2 snap3 'rsyslog (>= 7.4.4)'" - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines def check(self): self.check_output() @@ -116,7 +120,7 @@ class PullSnapshot7Test(BaseTest): ] runCmd = "aptly snapshot pull snap1 snap2 snap1 'rsyslog (>= 7.4.4)'" expectedCode = 1 - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines class PullSnapshot8Test(BaseTest): @@ -129,7 +133,7 @@ class PullSnapshot8Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-non-free", ] runCmd = "aptly snapshot pull snap1 snap2 snap3 lunar-landing 'mars-landing (>= 1.0)'" - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines def check(self): def remove_created_at(s): @@ -187,7 +191,7 @@ class PullSnapshot11Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-backports", ] runCmd = "aptly snapshot pull -no-remove snap1 snap2 snap3 'rsyslog (>= 7.4.4)'" - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines def check(self): def remove_created_at(s): @@ -243,4 +247,4 @@ class PullSnapshot15Test(BaseTest): "aptly snapshot create snap2 from mirror wheezy-backports", ] runCmd = "aptly snapshot pull -dep-verbose-resolve snap1 snap2 snap3 'rsyslog (>= 7.4.4)'" - outputMatchPrepare = lambda _, output: "\n".join(sorted(output.split("\n"))) + outputMatchPrepare = sortLines diff --git a/system/t05_snapshot/search.py b/system/t05_snapshot/search.py index cb9a594d..706ec706 100644 --- a/system/t05_snapshot/search.py +++ b/system/t05_snapshot/search.py @@ -1,12 +1,16 @@ from lib import BaseTest +def sortLines(_, s): + return "\n".join(sorted(s.split("\n"))) + + class SearchSnapshot1Test(BaseTest): """ search snapshot: regular search """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines fixtureCmds = ["aptly snapshot create wheezy-main from mirror wheezy-main"] runCmd = "aptly snapshot search wheezy-main '$$Architecture (i386), Name (% *-dev)'" @@ -35,7 +39,7 @@ class SearchSnapshot4Test(BaseTest): """ fixtureDB = True fixtureCmds = ["aptly snapshot create wheezy-main from mirror wheezy-main"] - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly snapshot search -with-deps wheezy-main 'Name (nginx)'" @@ -54,15 +58,16 @@ class SearchSnapshot6Test(BaseTest): search snapshot: with format """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines fixtureCmds = ["aptly snapshot create wheezy-main from mirror wheezy-main"] runCmd = "aptly snapshot search -format='{{.Package}}#{{.Version}}' wheezy-main '$$Architecture (i386), Name (% *-dev)'" + class SearchSnapshot7Test(BaseTest): """ search snapshot: without query """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines fixtureCmds = ["aptly snapshot create wheezy-main from mirror wheezy-main"] runCmd = "aptly snapshot search -format='{{.Package}}#{{.Version}}' wheezy-main" diff --git a/system/t05_snapshot/show.py b/system/t05_snapshot/show.py index 20380175..f1d84862 100644 --- a/system/t05_snapshot/show.py +++ b/system/t05_snapshot/show.py @@ -9,7 +9,9 @@ class ShowSnapshot1Test(BaseTest): fixtureDB = True fixtureCmds = ["aptly snapshot create snap1 from mirror wheezy-non-free"] runCmd = "aptly snapshot show --with-packages snap1" - outputMatchPrepare = lambda _, s: re.sub(r"Created At: [0-9:A-Za-z -]+\n", "", s) + + def outputMatchPrepare(_, s): + return re.sub(r"Created At: [0-9:A-Za-z -]+\n", "", s) class ShowSnapshot2Test(BaseTest): @@ -28,4 +30,6 @@ class ShowSnapshot3Test(BaseTest): fixtureDB = True fixtureCmds = ["aptly snapshot create snap1 from mirror wheezy-non-free"] runCmd = "aptly snapshot show snap1" - outputMatchPrepare = lambda _, s: re.sub(r"Created At: [0-9:A-Za-z -]+\n", "", s) + + def outputMatchPrepare(_, s): + return re.sub(r"Created At: [0-9:A-Za-z -]+\n", "", s) diff --git a/system/t06_publish/__init__.py b/system/t06_publish/__init__.py index 0ee80cf6..a5424e1b 100644 --- a/system/t06_publish/__init__.py +++ b/system/t06_publish/__init__.py @@ -1,14 +1,3 @@ """ Testing publishing snapshots """ - -from .fs_endpoint import * -from .drop import * -from .show import * -from .list import * -from .repo import * -from .snapshot import * -from .switch import * -from .update import * -from .s3 import * -from .swift import * diff --git a/system/t06_publish/fs_endpoint.py b/system/t06_publish/fs_endpoint.py index 34898e5f..2da2b599 100644 --- a/system/t06_publish/fs_endpoint.py +++ b/system/t06_publish/fs_endpoint.py @@ -106,7 +106,6 @@ class FSEndpointPublishSnapshot3Test(FileSystemEndpointTest): self.check_is_copy('public_copy/pool/main/g/gnuplot/gnuplot-doc_4.6.1-1~maverick2_all.deb') - class FSEndpointPublishSnapshot4Test(FileSystemEndpointTest): """ publish snapshot: using copy, symlink and hardlink variants @@ -566,4 +565,3 @@ class FSEndpointPublishSnapshot18Test(FileSystemEndpointTest): ] runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap2 filesystem:copysize:" gold_processor = FileSystemEndpointTest.expand_environ - diff --git a/system/t06_publish/repo.py b/system/t06_publish/repo.py index 36ad902a..ae840fc7 100644 --- a/system/t06_publish/repo.py +++ b/system/t06_publish/repo.py @@ -567,7 +567,9 @@ class PublishRepo23Test(BaseTest): ] runCmd = "aptly publish repo -component=main,contrib repo1" expectedCode = 2 - outputMatchPrepare = lambda _, s: "\n".join([l for l in s.split("\n") if l.startswith("ERROR")]) + + def outputMatchPrepare(_, s): + return "\n".join([l for l in s.split("\n") if l.startswith("ERROR")]) class PublishRepo24Test(BaseTest): @@ -616,7 +618,9 @@ class PublishRepo26Test(BaseTest): ] runCmd = "aptly publish repo -keyring=${files}/aptly_passphrase.pub -secret-keyring=${files}/aptly_passphrase.sec -passphrase=verysecret -distribution=maverick local-repo" gold_processor = BaseTest.expand_environ - outputMatchPrepare = lambda _, s: s.replace("gpg: gpg-agent is not available in this session\n", "") + + def outputMatchPrepare(_, s): + return s.replace("gpg: gpg-agent is not available in this session\n", "") def check(self): super(PublishRepo26Test, self).check() diff --git a/system/t06_publish/snapshot.py b/system/t06_publish/snapshot.py index 97ec30ed..732ac3f0 100644 --- a/system/t06_publish/snapshot.py +++ b/system/t06_publish/snapshot.py @@ -833,7 +833,9 @@ class PublishSnapshot32Test(BaseTest): ] runCmd = "aptly publish snapshot -component=main,contrib snap32.1" expectedCode = 2 - outputMatchPrepare = lambda _, s: "\n".join([l for l in s.split("\n") if l.startswith("ERROR")]) + + def outputMatchPrepare(_, s): + return "\n".join([l for l in s.split("\n") if l.startswith("ERROR")]) class PublishSnapshot33Test(BaseTest): diff --git a/system/t06_publish/switch.py b/system/t06_publish/switch.py index 4605641b..586ace7a 100644 --- a/system/t06_publish/switch.py +++ b/system/t06_publish/switch.py @@ -369,7 +369,9 @@ class PublishSwitch9Test(BaseTest): ] runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -component=a,b maverick snap2" expectedCode = 2 - outputMatchPrepare = lambda _, s: "\n".join([l for l in s.split("\n") if l.startswith("ERROR")]) + + def outputMatchPrepare(_, s): + return "\n".join([l for l in s.split("\n") if l.startswith("ERROR")]) class PublishSwitch10Test(BaseTest): diff --git a/system/t07_serve/__init__.py b/system/t07_serve/__init__.py index 1fb6e655..143fe756 100644 --- a/system/t07_serve/__init__.py +++ b/system/t07_serve/__init__.py @@ -8,10 +8,9 @@ import signal import subprocess import shlex import time -import errno from lib import BaseTest -from socket import error as socket_error + class RootDirInaccessible(BaseTest): """ @@ -21,12 +20,13 @@ class RootDirInaccessible(BaseTest): fixturePool = False configOverride = { - "rootDir": "/root" # any directory that exists but is not writable + "rootDir": "/root" # any directory that exists but is not writable } runCmd = "aptly serve -listen=127.0.0.1:8765" expectedCode = 1 + class Serve1Test(BaseTest): """ serve public: two publishes, verify HTTP diff --git a/system/t08_db/__init__.py b/system/t08_db/__init__.py index 8e1d52bb..80d3a517 100644 --- a/system/t08_db/__init__.py +++ b/system/t08_db/__init__.py @@ -1,6 +1,3 @@ """ Testing DB operations """ - -from .cleanup import * -from .recover import * diff --git a/system/t09_repo/__init__.py b/system/t09_repo/__init__.py index 302f65c1..7257d18e 100644 --- a/system/t09_repo/__init__.py +++ b/system/t09_repo/__init__.py @@ -1,17 +1,3 @@ """ Testing local repo management """ - -from .add import * -from .copy import * -from .create import * -from .drop import * -from .edit import * -from .cmdimport import * -from .list import * -from .move import * -from .remove import * -from .show import * -from .rename import * -from .search import * -from .include import * diff --git a/system/t09_repo/add.py b/system/t09_repo/add.py index 50fb27a2..a83db8bb 100644 --- a/system/t09_repo/add.py +++ b/system/t09_repo/add.py @@ -80,15 +80,15 @@ class AddRepo4Test(BaseTest): os.makedirs(os.path.join(self.tempSrcDir, "02", "03"), 0755) shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "libboost-program-options-dev_1.49.0.1_i386.deb"), - os.path.join(self.tempSrcDir, "01")) + os.path.join(self.tempSrcDir, "01")) shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.dsc"), - os.path.join(self.tempSrcDir, "02", "03")) + os.path.join(self.tempSrcDir, "02", "03")) shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1.orig.tar.gz"), - os.path.join(self.tempSrcDir, "02", "03")) + os.path.join(self.tempSrcDir, "02", "03")) shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.diff.gz"), - os.path.join(self.tempSrcDir, "02", "03")) + os.path.join(self.tempSrcDir, "02", "03")) shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.diff.gz"), - os.path.join(self.tempSrcDir, "02", "03", "other.file")) + os.path.join(self.tempSrcDir, "02", "03", "other.file")) self.runCmd += self.tempSrcDir @@ -124,9 +124,11 @@ class AddRepo5Test(BaseTest): "aptly repo create -comment=Repo5 -distribution=squeeze repo5", ] runCmd = "aptly repo add repo5 " - outputMatchPrepare = lambda self, s: s.replace(self.tempSrcDir, "") expectedCode = 1 + def outputMatchPrepare(self, s): + return s.replace(self.tempSrcDir, "") + def prepare(self): super(AddRepo5Test, self).prepare() @@ -134,9 +136,9 @@ class AddRepo5Test(BaseTest): os.makedirs(os.path.join(self.tempSrcDir, "02", "03"), 0755) shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.dsc"), - os.path.join(self.tempSrcDir, "02", "03")) + os.path.join(self.tempSrcDir, "02", "03")) shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1.orig.tar.gz"), - os.path.join(self.tempSrcDir, "02", "03")) + os.path.join(self.tempSrcDir, "02", "03")) self.runCmd += self.tempSrcDir @@ -175,9 +177,12 @@ class AddRepo8Test(BaseTest): "aptly repo add repo8 ${files}/pyspi_0.6.1-1.3.dsc", ] runCmd = "aptly repo add repo8 ${testfiles}/pyspi_0.6.1-1.3.conflict.dsc" - outputMatchPrepare = lambda self, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__), "").replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") expectedCode = 1 + def outputMatchPrepare(self, s): + return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__), ""). \ + replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") + def check(self): self.check_output() self.check_cmd_output("aptly repo show -with-packages repo8", "repo_show") @@ -192,9 +197,12 @@ class AddRepo9Test(BaseTest): ] runCmd = "aptly repo add repo9 ${files}/pyspi_0.6.1-1.3.dsc" gold_processor = BaseTest.expand_environ - outputMatchPrepare = lambda self, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") expectedCode = 1 + def outputMatchPrepare(self, s): + return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__), ""). \ + replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") + def prepare(self): super(AddRepo9Test, self).prepare() @@ -227,7 +235,10 @@ class AddRepo11Test(BaseTest): "aptly repo add repo11 ${files}/pyspi_0.6.1-1.3.dsc", ] runCmd = "aptly repo add -force-replace repo11 ${testfiles}/pyspi_0.6.1-1.3.conflict.dsc" - outputMatchPrepare = lambda self, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__), "").replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") + + def outputMatchPrepare(self, s): + return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__), ""). \ + replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") def check(self): self.check_output() @@ -294,5 +305,8 @@ class AddRepo15Test(BaseTest): "aptly repo create -comment=Repo15 -distribution=squeeze repo15", ] runCmd = "aptly repo add repo15 ${testfiles}" - outputMatchPrepare = lambda self, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__), "").replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") expectedCode = 1 + + def outputMatchPrepare(self, s): + return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__), ""). \ + replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "") diff --git a/system/t09_repo/create.py b/system/t09_repo/create.py index dbb87409..0fa68a1f 100644 --- a/system/t09_repo/create.py +++ b/system/t09_repo/create.py @@ -3,7 +3,8 @@ import inspect from lib import BaseTest -changesRemove = lambda _, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "") +def changesRemove(_, s): + return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "") class CreateRepo1Test(BaseTest): diff --git a/system/t09_repo/edit.py b/system/t09_repo/edit.py index 55e56985..96ec1934 100644 --- a/system/t09_repo/edit.py +++ b/system/t09_repo/edit.py @@ -3,7 +3,8 @@ import inspect from lib import BaseTest -changesRemove = lambda _, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "") +def changesRemove(_, s): + return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "") class EditRepo1Test(BaseTest): diff --git a/system/t09_repo/include.py b/system/t09_repo/include.py index 0df7c55f..96e14821 100644 --- a/system/t09_repo/include.py +++ b/system/t09_repo/include.py @@ -5,9 +5,17 @@ import inspect import re from lib import BaseTest -gpgRemove = lambda _, s: re.sub(r'Signature made .* using|gpgv: keyblock resource .*$|gpgv: Can\'t check signature: .*$', '', s, flags=re.MULTILINE) -changesRemove = lambda _, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "") -tempDirRemove = lambda self, s: s.replace(self.tempSrcDir, "") + +def gpgRemove(_, s): + return re.sub(r'Signature made .* using|gpgv: keyblock resource .*$|gpgv: Can\'t check signature: .*$', '', s, flags=re.MULTILINE) + + +def changesRemove(_, s): + return s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "changes"), "") + + +def tempDirRemove(self, s): + return s.replace(self.tempSrcDir, "") class IncludeRepo1Test(BaseTest): @@ -59,7 +67,9 @@ class IncludeRepo3Test(BaseTest): ] runCmd = "aptly repo include -no-remove-files -keyring=${files}/aptly.pub -repo=my-{{.Distribution} ${changes}" expectedCode = 1 - outputMatchPrepare = lambda _, s: s.replace('; missing space?', '') + + def outputMatchPrepare(_, s): + return s.replace('; missing space?', '') class IncludeRepo4Test(BaseTest): @@ -126,9 +136,11 @@ class IncludeRepo6Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -keyring=${files}/aptly.pub " - outputMatchPrepare = lambda self, s: gpgRemove(self, tempDirRemove(self, s)) expectedCode = 1 + def outputMatchPrepare(self, s): + return gpgRemove(self, tempDirRemove(self, s)) + def prepare(self): super(IncludeRepo6Test, self).prepare() @@ -161,9 +173,11 @@ class IncludeRepo7Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -keyring=${files}/aptly.pub " - outputMatchPrepare = lambda self, s: gpgRemove(self, tempDirRemove(self, s)) expectedCode = 1 + def outputMatchPrepare(self, s): + return gpgRemove(self, tempDirRemove(self, s)) + def prepare(self): super(IncludeRepo7Test, self).prepare() @@ -191,9 +205,11 @@ class IncludeRepo8Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -keyring=${files}/aptly.pub " - outputMatchPrepare = lambda self, s: gpgRemove(self, tempDirRemove(self, s)) expectedCode = 1 + def outputMatchPrepare(self, s): + return gpgRemove(self, tempDirRemove(self, s)) + def prepare(self): super(IncludeRepo8Test, self).prepare() @@ -224,9 +240,11 @@ class IncludeRepo9Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -keyring=${files}/aptly.pub " - outputMatchPrepare = lambda self, s: gpgRemove(self, tempDirRemove(self, s)) expectedCode = 1 + def outputMatchPrepare(self, s): + return gpgRemove(self, tempDirRemove(self, s)) + def prepare(self): super(IncludeRepo9Test, self).prepare() @@ -258,7 +276,9 @@ class IncludeRepo10Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -ignore-signatures " - outputMatchPrepare = lambda self, s: gpgRemove(self, tempDirRemove(self, s)) + + def outputMatchPrepare(self, s): + return gpgRemove(self, tempDirRemove(self, s)) def prepare(self): super(IncludeRepo10Test, self).prepare() @@ -290,7 +310,9 @@ class IncludeRepo11Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -accept-unsigned -keyring=${files}/aptly.pub " - outputMatchPrepare = lambda self, s: gpgRemove(self, tempDirRemove(self, s)) + + def outputMatchPrepare(self, s): + return gpgRemove(self, tempDirRemove(self, s)) def prepare(self): super(IncludeRepo11Test, self).prepare() @@ -323,9 +345,11 @@ class IncludeRepo12Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -accept-unsigned -keyring=${files}/aptly.pub " - outputMatchPrepare = lambda self, s: gpgRemove(self, tempDirRemove(self, s)) expectedCode = 1 + def outputMatchPrepare(self, s): + return gpgRemove(self, tempDirRemove(self, s)) + def prepare(self): super(IncludeRepo12Test, self).prepare() @@ -358,9 +382,11 @@ class IncludeRepo13Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -uploaders-file=${changes}/uploaders1.json -no-remove-files -keyring=${files}/aptly.pub ${changes}" - outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s)) expectedCode = 1 + def outputMatchPrepare(_, s): + return changesRemove(_, gpgRemove(_, s)) + class IncludeRepo14Test(BaseTest): """ @@ -370,7 +396,9 @@ class IncludeRepo14Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -uploaders-file=${changes}/uploaders2.json -no-remove-files -keyring=${files}/aptly.pub ${changes}" - outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s)) + + def outputMatchPrepare(_, s): + return changesRemove(_, gpgRemove(_, s)) class IncludeRepo15Test(BaseTest): @@ -381,9 +409,11 @@ class IncludeRepo15Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -uploaders-file=${changes}/uploaders-404.json -no-remove-files -keyring=${files}/aptly.pub ${changes}" - outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s)) expectedCode = 1 + def outputMatchPrepare(_, s): + return changesRemove(_, gpgRemove(_, s)) + class IncludeRepo16Test(BaseTest): """ @@ -393,9 +423,11 @@ class IncludeRepo16Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -uploaders-file=${changes}/uploaders3.json -no-remove-files -keyring=${files}/aptly.pub ${changes}" - outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s)) expectedCode = 1 + def outputMatchPrepare(_, s): + return changesRemove(_, gpgRemove(_, s)) + class IncludeRepo17Test(BaseTest): """ @@ -405,9 +437,11 @@ class IncludeRepo17Test(BaseTest): "aptly repo create unstable", ] runCmd = "aptly repo include -uploaders-file=${changes}/uploaders4.json -no-remove-files -keyring=${files}/aptly.pub ${changes}" - outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s)) expectedCode = 1 + def outputMatchPrepare(_, s): + return changesRemove(_, gpgRemove(_, s)) + class IncludeRepo18Test(BaseTest): """ @@ -417,7 +451,9 @@ class IncludeRepo18Test(BaseTest): "aptly repo create -uploaders-file=${changes}/uploaders2.json unstable", ] runCmd = "aptly repo include -uploaders-file=${changes}/uploaders1.json -no-remove-files -keyring=${files}/aptly.pub ${changes}" - outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s)) + + def outputMatchPrepare(_, s): + return changesRemove(_, gpgRemove(_, s)) class IncludeRepo19Test(BaseTest): @@ -428,5 +464,7 @@ class IncludeRepo19Test(BaseTest): "aptly repo create -uploaders-file=${changes}/uploaders1.json unstable", ] runCmd = "aptly repo include -no-remove-files -keyring=${files}/aptly.pub ${changes}" - outputMatchPrepare = lambda _, s: changesRemove(_, gpgRemove(_, s)) expectedCode = 1 + + def outputMatchPrepare(_, s): + return changesRemove(_, gpgRemove(_, s)) diff --git a/system/t09_repo/remove.py b/system/t09_repo/remove.py index 0dac69d6..5acb1d79 100644 --- a/system/t09_repo/remove.py +++ b/system/t09_repo/remove.py @@ -61,4 +61,3 @@ class RemoveRepo4Test(BaseTest): def output_processor(self, output): return "\n".join(sorted(output.split("\n"))) - diff --git a/system/t09_repo/search.py b/system/t09_repo/search.py index 5a423c51..eff546df 100644 --- a/system/t09_repo/search.py +++ b/system/t09_repo/search.py @@ -1,12 +1,16 @@ from lib import BaseTest +def sortLines(_, s): + return "\n".join(sorted(s.split("\n"))) + + class SearchRepo1Test(BaseTest): """ search repo: regular search """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines fixtureCmds = ["aptly repo create wheezy-main", "aptly repo import wheezy-main wheezy-main Name"] runCmd = "aptly repo search wheezy-main '$$Architecture (i386), Name (% *-dev)'" @@ -35,7 +39,7 @@ class SearchRepo4Test(BaseTest): """ fixtureDB = True fixtureCmds = ["aptly repo create wheezy-main", "aptly repo import wheezy-main wheezy-main Name"] - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly repo search -with-deps wheezy-main 'Name (nginx)'" @@ -44,15 +48,16 @@ class SearchRepo5Test(BaseTest): search repo: with -format """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines fixtureCmds = ["aptly repo create wheezy-main", "aptly repo import wheezy-main wheezy-main Name"] runCmd = "aptly repo search -format='{{.Package}}#{{.Version}}' wheezy-main '$$Architecture (i386), Name (% *-dev)'" + class SearchRepo6Test(BaseTest): """ search repo: without query """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines fixtureCmds = ["aptly repo create wheezy-main", "aptly repo import wheezy-main wheezy-main Name"] runCmd = "aptly repo search wheezy-main" diff --git a/system/t10_task/__init__.py b/system/t10_task/__init__.py index 00d32dc8..948d7873 100644 --- a/system/t10_task/__init__.py +++ b/system/t10_task/__init__.py @@ -1,5 +1,3 @@ """ Test aptly task run """ - -from .run import * diff --git a/system/t11_package/__init__.py b/system/t11_package/__init__.py index 73dc4f0c..554a8a7b 100644 --- a/system/t11_package/__init__.py +++ b/system/t11_package/__init__.py @@ -1,6 +1,3 @@ """ Testing package subcommands """ - -from .search import * -from .show import * diff --git a/system/t11_package/search.py b/system/t11_package/search.py index bd767a59..6f3e6577 100644 --- a/system/t11_package/search.py +++ b/system/t11_package/search.py @@ -1,12 +1,16 @@ from lib import BaseTest +def sortLines(_, s): + return "\n".join(sorted(s.split("\n"))) + + class SearchPackage1Test(BaseTest): """ search package: regular search """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package search '$$Architecture (i386), Name (% *-dev)'" @@ -31,7 +35,7 @@ class SearchPackage4Test(BaseTest): search package: by dependency """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package search coreutils" @@ -40,13 +44,14 @@ class SearchPackage5Test(BaseTest): search package: with format """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package search -format='{{.Package}}#{{.Version}}' '$$Architecture (i386), Name (% *-dev)'" + class SearchPackage6Test(BaseTest): """ search package: no query """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package search" diff --git a/system/t11_package/show.py b/system/t11_package/show.py index eb4ec759..c864afd3 100644 --- a/system/t11_package/show.py +++ b/system/t11_package/show.py @@ -1,12 +1,16 @@ from lib import BaseTest +def sortLines(_, s): + return "\n".join(sorted(s.split("\n"))) + + class ShowPackage1Test(BaseTest): """ show package: regular show """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package show 'Name (% nginx-extras*)'" @@ -22,7 +26,7 @@ class ShowPackage3Test(BaseTest): show package: by key """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package show nginx-full_1.2.1-2.2+wheezy2_amd64" @@ -31,7 +35,7 @@ class ShowPackage4Test(BaseTest): show package: with files """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines gold_processor = BaseTest.expand_environ runCmd = "aptly package show -with-files nginx-full_1.2.1-2.2+wheezy2_amd64" @@ -41,7 +45,7 @@ class ShowPackage5Test(BaseTest): show package: with inclusion """ fixtureDB = True - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package show -with-references nginx-full_1.2.1-2.2+wheezy2_amd64" @@ -58,7 +62,7 @@ class ShowPackage6Test(BaseTest): "aptly repo create repo1", "aptly repo import wheezy-main repo1 nginx", ] - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package show -with-references nginx-full_1.2.1-2.2+wheezy2_amd64" @@ -72,5 +76,5 @@ class ShowPackage7Test(BaseTest): "aptly repo add a ${files}", "aptly repo add b ${testfiles}" ] - outputMatchPrepare = lambda _, s: "\n".join(sorted(s.split("\n"))) + outputMatchPrepare = sortLines runCmd = "aptly package show -with-references \"pyspi (0.6.1-1.3)\"" diff --git a/system/t12_api/__init__.py b/system/t12_api/__init__.py index 41959ec4..7b20aa85 100644 --- a/system/t12_api/__init__.py +++ b/system/t12_api/__init__.py @@ -1,13 +1,3 @@ """ Testing aptly REST API """ - -from .repos import * -from .files import * -from .publish import * -from .version import * -from .graph import * -from .snapshots import * -from .packages import * -from .unix_socket import * -from .systemd_handover import * diff --git a/system/t12_api/graph.py b/system/t12_api/graph.py index bf84ec4c..020a8ef2 100644 --- a/system/t12_api/graph.py +++ b/system/t12_api/graph.py @@ -31,10 +31,10 @@ class GraphAPITest(APITest): horizontal = self.get("/api/graph.svg?layout=horizontal").content vertical = self.get("/api/graph.svg?layout=vertical").content - horizontalWidth = int(ET.fromstring(horizontal).get('width').replace("pt","")) - horizontalHeight = int(ET.fromstring(horizontal).get('height').replace("pt","")) - verticalWidth = int(ET.fromstring(vertical).get('width').replace("pt","")) - verticalHeight = int(ET.fromstring(vertical).get('height').replace("pt","")) + horizontalWidth = int(ET.fromstring(horizontal).get('width').replace("pt", "")) + horizontalHeight = int(ET.fromstring(horizontal).get('height').replace("pt", "")) + verticalWidth = int(ET.fromstring(vertical).get('width').replace("pt", "")) + verticalHeight = int(ET.fromstring(vertical).get('height').replace("pt", "")) self.check_gt(horizontalWidth, verticalWidth) self.check_gt(verticalHeight, horizontalHeight) diff --git a/system/t12_api/packages.py b/system/t12_api/packages.py index ca158b8a..27dae270 100644 --- a/system/t12_api/packages.py +++ b/system/t12_api/packages.py @@ -24,11 +24,11 @@ class PackagesAPITestShow(APITest): self.check_equal(resp.json(), { 'Architecture': 'any', 'Binary': 'python-at-spi', - 'Build-Depends': 'debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev', - 'Checksums-Sha1': ' 95a2468e4bbce730ba286f2211fa41861b9f1d90 3456 pyspi_0.6.1-1.3.diff.gz\n 56c8a9b1f4ab636052be8966690998cbe865cd6c 1782 pyspi_0.6.1-1.3.dsc\n 9694b80acc171c0a5bc99f707933864edfce555e 29063 pyspi_0.6.1.orig.tar.gz\n', - 'Checksums-Sha256': ' 2e770b28df948f3197ed0b679bdea99f3f2bf745e9ddb440c677df9c3aeaee3c 3456 pyspi_0.6.1-1.3.diff.gz\n d494aaf526f1ec6b02f14c2f81e060a5722d6532ddc760ec16972e45c2625989 1782 pyspi_0.6.1-1.3.dsc\n 64069ee828c50b1c597d10a3fefbba279f093a4723965388cdd0ac02f029bfb9 29063 pyspi_0.6.1.orig.tar.gz\n', - 'Checksums-Sha512': ' 384b5e94b4113262e41bda1a2563f4f439cb8c97f43e2caefe16d7626718c21b36d3145b915eed24053eaa7fe3b6186494a87a3fcf9627f6e653b54bb3caa897 3456 pyspi_0.6.1-1.3.diff.gz\n fde06b7dc5762a04986d0669420822f6a1e82b195322ae9cbd2dae40bda557c57ad77fe3546007ea645f801c4cd30ef4eb0e96efb2dee6b71c4c9a187d643683 1782 pyspi_0.6.1-1.3.dsc\n c278f52953203292bcc828bcf05aee456b160f91716f51ec1a1dbbcdb8b08fc29183d0a1135629fc0ebe86a3e84cedc685c3aa1714b70cc5db8877d40e754d7f 29063 pyspi_0.6.1.orig.tar.gz\n', - 'Files': ' 22ff26db69b73d3438fdde21ab5ba2f1 3456 pyspi_0.6.1-1.3.diff.gz\n b72cb94699298a117b7c82641c68b6fd 1782 pyspi_0.6.1-1.3.dsc\n def336bd566ea688a06ec03db7ccf1f4 29063 pyspi_0.6.1.orig.tar.gz\n', + 'Build-Depends': 'debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev', # noqa + 'Checksums-Sha1': ' 95a2468e4bbce730ba286f2211fa41861b9f1d90 3456 pyspi_0.6.1-1.3.diff.gz\n 56c8a9b1f4ab636052be8966690998cbe865cd6c 1782 pyspi_0.6.1-1.3.dsc\n 9694b80acc171c0a5bc99f707933864edfce555e 29063 pyspi_0.6.1.orig.tar.gz\n', # noqa + 'Checksums-Sha256': ' 2e770b28df948f3197ed0b679bdea99f3f2bf745e9ddb440c677df9c3aeaee3c 3456 pyspi_0.6.1-1.3.diff.gz\n d494aaf526f1ec6b02f14c2f81e060a5722d6532ddc760ec16972e45c2625989 1782 pyspi_0.6.1-1.3.dsc\n 64069ee828c50b1c597d10a3fefbba279f093a4723965388cdd0ac02f029bfb9 29063 pyspi_0.6.1.orig.tar.gz\n', # noqa + 'Checksums-Sha512': ' 384b5e94b4113262e41bda1a2563f4f439cb8c97f43e2caefe16d7626718c21b36d3145b915eed24053eaa7fe3b6186494a87a3fcf9627f6e653b54bb3caa897 3456 pyspi_0.6.1-1.3.diff.gz\n fde06b7dc5762a04986d0669420822f6a1e82b195322ae9cbd2dae40bda557c57ad77fe3546007ea645f801c4cd30ef4eb0e96efb2dee6b71c4c9a187d643683 1782 pyspi_0.6.1-1.3.dsc\n c278f52953203292bcc828bcf05aee456b160f91716f51ec1a1dbbcdb8b08fc29183d0a1135629fc0ebe86a3e84cedc685c3aa1714b70cc5db8877d40e754d7f 29063 pyspi_0.6.1.orig.tar.gz\n', # noqa + 'Files': ' 22ff26db69b73d3438fdde21ab5ba2f1 3456 pyspi_0.6.1-1.3.diff.gz\n b72cb94699298a117b7c82641c68b6fd 1782 pyspi_0.6.1-1.3.dsc\n def336bd566ea688a06ec03db7ccf1f4 29063 pyspi_0.6.1.orig.tar.gz\n', # noqa 'FilesHash': '3a8b37cbd9a3559e', 'Format': '1.0', 'Homepage': 'http://people.redhat.com/zcerza/dogtail', diff --git a/system/t12_api/publish.py b/system/t12_api/publish.py index 1e07be4b..5825527e 100644 --- a/system/t12_api/publish.py +++ b/system/t12_api/publish.py @@ -21,9 +21,9 @@ class PublishAPITestRepo(APITest): d = self.random_name() self.check_equal(self.upload("/api/files/" + d, - "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", - "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", - "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) + "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", + "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", + "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) self.check_equal(self.post("/api/repos/" + repo_name + "/file/" + d).status_code, 200) @@ -150,10 +150,11 @@ class PublishUpdateAPITestRepo(APITest): self.check_equal(self.post("/api/repos", json={"Name": repo_name, "DefaultDistribution": "wheezy"}).status_code, 201) d = self.random_name() - self.check_equal(self.upload("/api/files/" + d, - "pyspi_0.6.1-1.3.dsc", - "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", - "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) + self.check_equal( + self.upload("/api/files/" + d, + "pyspi_0.6.1-1.3.dsc", + "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", + "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) self.check_equal(self.post("/api/repos/" + repo_name + "/file/" + d).status_code, 200) prefix = self.random_name() @@ -214,10 +215,11 @@ class PublishSwitchAPITestRepo(APITest): self.check_equal(self.post("/api/repos", json={"Name": repo_name, "DefaultDistribution": "wheezy"}).status_code, 201) d = self.random_name() - self.check_equal(self.upload("/api/files/" + d, - "pyspi_0.6.1-1.3.dsc", - "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", - "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) + self.check_equal( + self.upload("/api/files/" + d, + "pyspi_0.6.1-1.3.dsc", + "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", + "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) self.check_equal(self.post("/api/repos/" + repo_name + "/file/" + d).status_code, 200) snapshot1_name = self.random_name() diff --git a/system/t12_api/repos.py b/system/t12_api/repos.py index 0e7feb60..86cf4f5d 100644 --- a/system/t12_api/repos.py +++ b/system/t12_api/repos.py @@ -186,10 +186,11 @@ class ReposAPITestShowQuery(APITest): self.check_equal(self.post("/api/repos", json={"Name": repo_name, "Comment": "fun repo"}).status_code, 201) d = self.random_name() - self.check_equal(self.upload("/api/files/" + d, - "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", - "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", - "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) + self.check_equal( + self.upload("/api/files/" + d, + "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", + "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", + "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) self.check_equal(self.post("/api/repos/" + repo_name + "/file/" + d).status_code, 200) self.check_equal(sorted(self.get("/api/repos/" + repo_name + "/packages", params={"q": "pyspi"}).json()), @@ -217,10 +218,11 @@ class ReposAPITestAddMultiple(APITest): self.check_equal(self.post("/api/repos", json={"Name": repo_name, "Comment": "fun repo"}).status_code, 201) d = self.random_name() - self.check_equal(self.upload("/api/files/" + d, - "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", - "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", - "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) + self.check_equal( + self.upload("/api/files/" + d, + "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", + "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", + "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) self.check_equal(self.post("/api/repos/" + repo_name + "/file/" + d + "/pyspi_0.6.1-1.3.dsc", params={"noRemove": 1}).status_code, 200) @@ -244,10 +246,11 @@ class ReposAPITestPackagesAddDelete(APITest): self.check_equal(self.post("/api/repos", json={"Name": repo_name, "Comment": "fun repo"}).status_code, 201) d = self.random_name() - self.check_equal(self.upload("/api/files/" + d, - "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", - "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", - "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) + self.check_equal( + self.upload("/api/files/" + d, + "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", + "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", + "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) self.check_equal(self.post("/api/repos/" + repo_name + "/file/" + d).status_code, 200) diff --git a/system/t12_api/snapshots.py b/system/t12_api/snapshots.py index 6d093038..da139c83 100644 --- a/system/t12_api/snapshots.py +++ b/system/t12_api/snapshots.py @@ -101,7 +101,6 @@ class SnapshotsAPITestCreateFromRepo(APITest): self.check_equal([], self.get("/api/snapshots/" + snapshot_name + "/packages", params={"format": "details"}).json()) - snapshot_name = self.random_name() d = self.random_name() self.check_equal(self.upload("/api/files/" + d,