Skip to content

Commit

Permalink
[#2838] fix multiple tests to pass email_is_unique validator
Browse files Browse the repository at this point in the history
  • Loading branch information
calexandr committed Jan 10, 2020
1 parent 8b3d894 commit 3aa3ee0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ckan/tests/logic/action/test_update.py
Expand Up @@ -144,7 +144,6 @@ def test_user_update_with_invalid_name(self, name):
user = factories.User()
user["name"] = name
with pytest.raises(logic.ValidationError):

helpers.call_action("user_update", **user)

def test_user_update_to_name_that_already_exists(self):
Expand All @@ -166,7 +165,8 @@ def test_user_update_password(self):
# we're not updating it, otherwise validation fails.
helpers.call_action(
"user_update",
id=user["name"],
id=user["id"],
name=user["name"],
email=user["email"],
password="new password",
)
Expand Down Expand Up @@ -254,7 +254,8 @@ def test_user_update_activity_stream(self):
# fails.
helpers.call_action(
"user_update",
id=user["name"],
id=user["id"],
name=user["name"],
email=user["email"],
password=factories.User.attributes()["password"],
fullname="updated full name",
Expand Down Expand Up @@ -301,17 +302,13 @@ def test_user_update_with_custom_schema(self):
helpers.call_action(
"user_update",
context={"schema": schema},
id=user["name"],
id=user["id"],
name=user["name"],
email=user["email"],
password=factories.User.attributes()["password"],
fullname="updated full name",
)

# Since we passed user['name'] to user_update as the 'id' param,
# our mock validator method should have been called once with
# user['name'] as arg.
mock_validator.assert_called_once_with(user["name"])

def test_user_update_multiple(self):
"""Test that updating multiple user attributes at once works."""

Expand Down

0 comments on commit 3aa3ee0

Please sign in to comment.