summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Callaghan <dcallagh@redhat.com>2017-10-10 08:52:07 +1000
committerDan Callaghan <dcallagh@redhat.com>2017-10-10 09:01:49 +1000
commita7d5921d31453c394a31062a8b0039bb047ee11a (patch)
tree03e1ff70857fc395d325b3cdb4fd4e45b32fc9b0
parent1bd7e775bd34ad774278d803d0db050d44eaa449 (diff)
tests: requests exception message has changed
Newer versions of requests have started including the failing URL in exception messages. We can adjust the test case assertions to handle both possibilities. This fixes failures like this: FAIL: test_on_error_warns_if_server_version_does_not_match (bkr.inttest.client.test_common_options.CommonOptionsTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "IntegrationTests/src/bkr/inttest/client/test_common_options.py", line 54, in test_on_error_warns_if_server_version_does_not_match % __version__) AssertionError: 'WARN[91 chars]Found for url: http://localhost:19998/systems/[21 chars]us\n' != 'WARN[91 chars]Found\n' WARNING: client version is 24.4 but server version is 999.3 - HTTP error: 404 Client Error: Not Found for url: http://localhost:19998/systems/asdf.example.com/status + HTTP error: 404 Client Error: Not Found Change-Id: I0fa06703f53560c04ac9b09f3d5256ec2b388a21
-rw-r--r--IntegrationTests/src/bkr/inttest/client/test_common_options.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/IntegrationTests/src/bkr/inttest/client/test_common_options.py b/IntegrationTests/src/bkr/inttest/client/test_common_options.py
index 1520785..f09b7c9 100644
--- a/IntegrationTests/src/bkr/inttest/client/test_common_options.py
+++ b/IntegrationTests/src/bkr/inttest/client/test_common_options.py
@@ -48,7 +48,9 @@ class CommonOptionsTest(ClientTestCase):
run_client(['bkr', 'system-status', 'asdf.example.com'], config=config)
self.fail('should raise')
except ClientError as e:
- self.assertEquals(e.stderr_output,
- 'WARNING: client version is %s but server version is 999.3\n'
- 'HTTP error: 404 Client Error: Not Found\n'
+ error_lines = e.stderr_output.splitlines()
+ self.assertEquals(error_lines[0],
+ 'WARNING: client version is %s but server version is 999.3'
% __version__)
+ self.assertIn('HTTP error: 404 Client Error: Not Found',
+ error_lines[1])