Expect ValidationError on an empty user update

Applying an empty change on user attributes should raise a
ValidationError.

This is a requirement for:
https://review.openstack.org/#/c/210004/

Depends-On: I5ab58fd64f4745a2e558392bff649b05401ed57a
Change-Id: I778bb408ba1f3b58037b77e56e33ee0020156c86
Closes-Bug: 1482279
This commit is contained in:
Petr Malik 2015-08-30 22:02:12 -04:00 committed by Craig Vyvial
parent f1b8cead58
commit f8f3183527
1 changed files with 4 additions and 3 deletions

View File

@ -24,6 +24,7 @@ from proboscis.asserts import fail
from proboscis import before_class
from proboscis import test
from troveclient.compat import exceptions
from troveclient.openstack.common.apiclient.exceptions import ValidationError
from trove import tests
from trove.tests.api.databases import TestDatabases
@ -89,7 +90,7 @@ class TestUsers(object):
users.append({"name": self.username, "password": self.password,
"databases": [{"name": self.db1}]})
users.append({"name": self.username1, "password": self.password1,
"databases": [{"name": self.db1}, {"name": self.db2}]})
"databases": [{"name": self.db1}, {"name": self.db2}]})
self.dbaas.users.create(instance_info.id, users)
assert_equal(202, self.dbaas.last_http_code)
@ -121,7 +122,7 @@ class TestUsers(object):
users.append({"name": self.username, "password": self.password,
"databases": [{"name": self.db1}]})
users.append({"name": self.username1, "password": self.password1,
"databases": [{"name": self.db1}, {"name": self.db2}]})
"databases": [{"name": self.db1}, {"name": self.db2}]})
assert_raises(exceptions.BadRequest, self.dbaas.users.create,
instance_info.id, users)
assert_equal(400, self.dbaas.last_http_code)
@ -318,7 +319,7 @@ class TestUsers(object):
"host": hostname, "databases": []})
self.dbaas.users.create(instance_info.id, users)
user_new = {}
assert_raises(Exception,
assert_raises(ValidationError,
self.dbaas.users.update_attributes, instance_info.id,
username, user_new, hostname)
# The last_http_code doesn't have to be checked, since the exception