Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 8331efa

Browse files
committed
Fixed invalid DB name test
The HEAD on an invalid DB name that doesn't exist returns a 400 in 1.7.2 but a 404 in 1.7.1 and 2.x
1 parent d84a0ea commit 8331efa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/unit/client_tests.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (C) 2015, 2019 IBM Corp. All rights reserved.
2+
# Copyright (C) 2015, 2020 IBM Corp. All rights reserved.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -405,9 +405,10 @@ def test_create_invalid_database_name(self):
405405
"""
406406
dbname = 'invalidDbName_'
407407
self.client.connect()
408-
with self.assertRaises(CloudantDatabaseException) as cm:
408+
with self.assertRaises((CloudantDatabaseException, HTTPError)) as cm:
409409
self.client.create_database(dbname)
410-
self.assertEqual(cm.exception.status_code, 400)
410+
code = cm.exception.status_code if hasattr(cm.exception, 'status_code') else cm.exception.response.status_code
411+
self.assertEqual(code, 400)
411412
self.client.disconnect()
412413

413414
@skip_if_not_cookie_auth

0 commit comments

Comments
 (0)