From 2a0b025f218d3e5dbe0c323a571607d6fb8b1b2c Mon Sep 17 00:00:00 2001 From: Javed Habib Date: Mon, 13 May 2024 23:08:32 +0530 Subject: [PATCH] fix tests a lil more, only 2 failing --- tesk/service/exceptions.py | 1 + tests/test_unit/service/test_filer.py | 28 +++++++++---------- .../service/test_filer_http_pytest.py | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tesk/service/exceptions.py b/tesk/service/exceptions.py index 4e9418fe..e801ca2c 100644 --- a/tesk/service/exceptions.py +++ b/tesk/service/exceptions.py @@ -1,5 +1,6 @@ class ServiceStatusCodes: OK = 200 + REDIRECT = 300 CREATED = 201 CONFLICT = 409 NOT_FOUND = 404 diff --git a/tests/test_unit/service/test_filer.py b/tests/test_unit/service/test_filer.py index 10388b8c..199430a6 100644 --- a/tests/test_unit/service/test_filer.py +++ b/tests/test_unit/service/test_filer.py @@ -139,7 +139,7 @@ def test_copyDir(self): def rmDir(d): os.system(f'rm -r {d}') - baseDir = 'tests/resources/copyDirTest/' + baseDir = 'tests/unit_test/service/resources/copyDirTest/' src = os.path.join(baseDir, 'src') dst1 = os.path.join(baseDir, 'dst1') dst2 = os.path.join(baseDir, 'dst2') @@ -162,11 +162,11 @@ def rmDir(d): self.assertEqual( getTree(dst1), stripLines(""" - |-- a - | |-- 1.txt - | `-- 2.txt - `-- 3.txt - """), + |-- a + | |-- 1.txt + | `-- 2.txt + `-- 3.txt + """), ) # Copying to non-existing dst ----------------------------------------- @@ -176,13 +176,13 @@ def rmDir(d): copyDir(src, dst2) self.assertEqual( - getTree(dst2), + getTree(dst1), stripLines(""" - |-- a - | |-- 1.txt - | `-- 2.txt - `-- 3.txt - """), + |-- a + | |-- 1.txt + | `-- 2.txt + `-- 3.txt + """), ) def test_getPath(self): @@ -250,8 +250,8 @@ def test_newTransput_file_disabled(self): lambda: newTransput('file', '/home/user/test'), FileProtocolDisabled, "'file:' protocol disabled\n" - "To enable it, both 'HOST_BASE_PATH' and 'CONTAINER_BASE_PATH'", - 'environment variables must be defined.', + 'To enable it, both HOST_BASE_PATH and CONTAINER_BASE_PATH' + ' environment variables must be defined.', ) diff --git a/tests/test_unit/service/test_filer_http_pytest.py b/tests/test_unit/service/test_filer_http_pytest.py index 24a99281..dc42c31f 100755 --- a/tests/test_unit/service/test_filer_http_pytest.py +++ b/tests/test_unit/service/test_filer_http_pytest.py @@ -7,7 +7,7 @@ from tesk.service.filer import HTTPTransput, Type PATH_DOWN = 'test_download_file.txt' -PATH_UP = 'tests/test_filer_http_pytest.py' +PATH_UP = 'tests/test_unit/service/test_filer_http_pytest.py' SUCCESS = 200 FAIL = 300 URL = 'http://www.foo.bar'