Skip to content

Commit

Permalink
systemtest: fix python list test
Browse files Browse the repository at this point in the history
  • Loading branch information
alaaeddineelamri committed Apr 5, 2022
1 parent 552914f commit 59c4a59
Showing 1 changed file with 38 additions and 14 deletions.
52 changes: 38 additions & 14 deletions systemtests/tests/python-bareos/test_list_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ def test_list_jobs(self):
"jobbytes",
"jobstatus",
]
resultkeys = list(result["jobs"][0].keys())
resultkeys.sort()
expected_list_keys.sort()
self.assertEqual(
list(result["jobs"][0].keys()).sort(),
expected_list_keys.sort(),
resultkeys,
expected_list_keys,
)
reg = re.compile("..:..:..")
self.assertTrue(re.match(reg, result["jobs"][0]["duration"]))
Expand Down Expand Up @@ -114,9 +117,13 @@ def test_list_jobs(self):
"filesetid",
"fileset",
]
resultkeys = list(result["jobs"][0].keys())

resultkeys.sort()
expected_long_list_keys.sort()
self.assertEqual(
list(result["jobs"][0].keys()).sort(),
expected_long_list_keys.sort(),
resultkeys,
expected_long_list_keys,
)

# Long list with options
Expand Down Expand Up @@ -167,9 +174,13 @@ def test_list_jobs(self):
"filesetid",
"fileset",
]
resultkeys = list(result["jobs"][0].keys())

resultkeys.sort()
expected_long_list_last_keys.sort()
self.assertEqual(
list(result["jobs"][0].keys()).sort(),
expected_long_list_last_keys.sort(),
resultkeys,
expected_long_list_last_keys,
)

result = director.call("llist jobs last current")
Expand Down Expand Up @@ -272,9 +283,13 @@ def test_list_media(self):
"lastwritten",
"storage",
]
resultkeys = list(result["volumes"]["full"][0].keys())

resultkeys.sort()
expected_list_media_keys.sort()
self.assertEqual(
list(result["volumes"]["full"][0].keys()).sort(),
expected_list_media_keys.sort(),
resultkeys,
expected_list_media_keys,
)

# check expected behavior when asking for specific volume by name
Expand Down Expand Up @@ -338,17 +353,22 @@ def test_list_pool(self):
director.call("wait")

result = director.call("list pool")
expected_list_media_keys = [
expected_list_pool_keys = [
"poolid",
"name",
"numvols",
"maxvols",
"pooltype",
"labelformat",
]

resultkeys = list(result["pools"][0].keys())

resultkeys.sort()
expected_list_pool_keys.sort()
self.assertEqual(
list(result["pools"][0].keys()).sort(),
expected_list_media_keys.sort(),
resultkeys,
expected_list_pool_keys,
)

# check expected behavior when asking for specific volume by name
Expand All @@ -359,7 +379,7 @@ def test_list_pool(self):
)

result = director.call("llist pool")
expected_list_media_keys = [
expected_long_list_pool_keys = [
"poolid",
"name",
"numvols",
Expand All @@ -380,9 +400,13 @@ def test_list_pool(self):
"recyclepoolid",
"labeltype",
]
resultkeys = list(result["pools"][0].keys())

resultkeys.sort()
expected_long_list_pool_keys.sort()
self.assertEqual(
list(result["pools"][0].keys()).sort(),
expected_list_media_keys.sort(),
resultkeys,
expected_long_list_pool_keys,
)

# check expected behavior when asking for specific volume by name
Expand Down

0 comments on commit 59c4a59

Please sign in to comment.