summaryrefslogtreecommitdiffhomepage
path: root/test/test_python_isolation.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2023-05-25 16:56:14 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2023-05-25 16:56:14 +0100
commitb034bf67034c4f0e966ebd207ba2f407f6f15fa8 (patch)
treeed2f338b2283b2b4d4ec562ab7e251268ac3f0fa /test/test_python_isolation.py
parent0132e552d0b9e8b724015728b5fbd7dad9d2edcb (diff)
downloadunit-b034bf67034c4f0e966ebd207ba2f407f6f15fa8.tar.gz
unit-b034bf67034c4f0e966ebd207ba2f407f6f15fa8.tar.bz2
Tests: assertion related fixes.
Diffstat (limited to 'test/test_python_isolation.py')
-rw-r--r--test/test_python_isolation.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/test/test_python_isolation.py b/test/test_python_isolation.py
index 35ca4a56..506d20b7 100644
--- a/test/test_python_isolation.py
+++ b/test/test_python_isolation.py
@@ -58,27 +58,25 @@ class TestPythonIsolation(TestApplicationPython):
self.load('ns_inspect', isolation=isolation)
- assert (
+ assert not (
self.getjson(url=f'/?path={temp_dir}')['body']['FileExists']
- == False
), 'temp_dir does not exists in rootfs'
- assert (
- self.getjson(url='/?path=/proc/self')['body']['FileExists'] == True
- ), 'no /proc/self'
+ assert self.getjson(url='/?path=/proc/self')['body'][
+ 'FileExists'
+ ], 'no /proc/self'
- assert (
- self.getjson(url='/?path=/dev/pts')['body']['FileExists'] == False
+ assert not (
+ self.getjson(url='/?path=/dev/pts')['body']['FileExists']
), 'no /dev/pts'
- assert (
+ assert not (
self.getjson(url='/?path=/sys/kernel')['body']['FileExists']
- == False
), 'no /sys/kernel'
ret = self.getjson(url='/?path=/app/python/ns_inspect')
- assert ret['body']['FileExists'] == True, 'application exists in rootfs'
+ assert ret['body']['FileExists'], 'application exists in rootfs'
def test_python_isolation_rootfs_no_language_deps(self, is_su, temp_dir):
if not is_su:
@@ -113,17 +111,17 @@ class TestPythonIsolation(TestApplicationPython):
self.load('ns_inspect', isolation=isolation)
- assert (
- self.getjson(url='/?path=/proc/self')['body']['FileExists'] == False
+ assert not (
+ self.getjson(url='/?path=/proc/self')['body']['FileExists']
), 'no /proc/self'
isolation['automount']['procfs'] = True
self.load('ns_inspect', isolation=isolation)
- assert (
- self.getjson(url='/?path=/proc/self')['body']['FileExists'] == True
- ), '/proc/self'
+ assert self.getjson(url='/?path=/proc/self')['body'][
+ 'FileExists'
+ ], '/proc/self'
def test_python_isolation_cgroup(self, is_su):
if not is_su: