mirror of
https://github.com/containers/podman.git
synced 2025-06-22 01:48:54 +08:00
Small API test improvement for compatibility search endpoint
Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
This commit is contained in:
@ -374,13 +374,13 @@ class TestApi(unittest.TestCase):
|
|||||||
self.assertEqual(len(objs), 1)
|
self.assertEqual(len(objs), 1)
|
||||||
|
|
||||||
def do_search3():
|
def do_search3():
|
||||||
payload = {'term': 'alpine', 'filters': {'is-official': True}}
|
payload = {'term': 'alpine', 'filters': '{"is-official":["true"]}'}
|
||||||
r = requests.get(url, params=payload, timeout=5)
|
r = requests.get(url, params=payload, timeout=5)
|
||||||
self.assertEqual(r.status_code, 200, r.text)
|
self.assertEqual(r.status_code, 200, r.text)
|
||||||
objs = json.loads(r.text)
|
objs = json.loads(r.text)
|
||||||
self.assertIn(type(objs), (list,))
|
self.assertIn(type(objs), (list,))
|
||||||
# TODO: Request should return only one item, but it returns more. For now this check is commented out.
|
# There should be only one offical image
|
||||||
# self.assertEqual(len(objs), 1)
|
self.assertEqual(len(objs), 1)
|
||||||
|
|
||||||
def do_search4():
|
def do_search4():
|
||||||
headers = {'X-Registry-Auth': 'null'}
|
headers = {'X-Registry-Auth': 'null'}
|
||||||
@ -401,19 +401,6 @@ class TestApi(unittest.TestCase):
|
|||||||
search.join(timeout=10)
|
search.join(timeout=10)
|
||||||
self.assertFalse(search.is_alive(), "/images/search took too long")
|
self.assertFalse(search.is_alive(), "/images/search took too long")
|
||||||
|
|
||||||
def test_search_compat_with_(self):
|
|
||||||
# Had issues with this test hanging when repositories not happy
|
|
||||||
def do_search():
|
|
||||||
r = requests.get(PODMAN_URL + "/v1.40/images/search?term=alpine", timeout=5)
|
|
||||||
self.assertEqual(r.status_code, 200, r.text)
|
|
||||||
objs = json.loads(r.text)
|
|
||||||
self.assertIn(type(objs), (list,))
|
|
||||||
|
|
||||||
search = Process(target=do_search)
|
|
||||||
search.start()
|
|
||||||
search.join(timeout=10)
|
|
||||||
self.assertFalse(search.is_alive(), "/images/search took too long")
|
|
||||||
|
|
||||||
def test_ping(self):
|
def test_ping(self):
|
||||||
required_headers = (
|
required_headers = (
|
||||||
"API-Version",
|
"API-Version",
|
||||||
|
Reference in New Issue
Block a user