diff --git a/tests/obs.py b/tests/obs.py index d8718b77..0d2d7b5d 100644 --- a/tests/obs.py +++ b/tests/obs.py @@ -145,6 +145,12 @@ class OBS: reply = self.responses[request.method][path] # We have something to reply with if reply: + # It's a dict, therefore there is return code as well + if isinstance(reply, dict): + ret_code = reply['status'] + reply = reply['reply'] + else: + ret_code = 200 # It's a list, so take the first if isinstance(reply, list): reply = reply.pop(0) @@ -152,13 +158,13 @@ class OBS: if isinstance(reply, string_types): # It's XML if reply.startswith('<'): - return (200, headers, reply) + return (ret_code, headers, reply) # It's fixture else: - return (200, headers, self._get_fixture_content(reply)) + return (ret_code, headers, self._get_fixture_content(reply)) # All is left is callback function else: - return (200, headers, reply(self.responses, request, uri)) + return (ret_code, headers, reply(self.responses, request, uri)) # No possible response found else: if len(path) == 0: diff --git a/tests/select_tests.py b/tests/select_tests.py index dcd32aa9..17c4490c 100644 --- a/tests/select_tests.py +++ b/tests/select_tests.py @@ -55,8 +55,7 @@ class TestSelect(unittest.TestCase): # search for requests self.obs.responses['GET']['/request'] = '' - # TODO: it's actually 404 - but OBS class can't handle that ;( - self.obs.responses['GET']['/request/bash'] = '' + self.obs.responses['GET']['/request/bash'] = {'status': 404, 'reply': '' } with self.assertRaises(oscerr.WrongArgs) as cm: SelectCommand(self.obs.api).perform('openSUSE:Factory:Staging:A', ['bash'])