Skip to content

Commit

Permalink
fix: assert on warning instead of ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
jorwoods committed Aug 23, 2024
1 parent 8155de7 commit 0e7602a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,23 @@ def test_populate_groups(self) -> None:
self.assertEqual("TableauExample", group_list[2].name)
self.assertEqual("local", group_list[2].domain_name)

@pytest.mark.filterwarnings("ignore:This method is deprecated, use bulk_add instead")
def test_get_usernames_from_file(self):
with open(ADD_XML, "rb") as f:
response_xml = f.read().decode("utf-8")
with requests_mock.mock() as m:
m.post(self.server.users.baseurl, text=response_xml)
user_list, failures = self.server.users.create_from_file(USERNAMES)
with pytest.warns(DeprecationWarning, match="This method is deprecated, use bulk_add instead"):
user_list, failures = self.server.users.create_from_file(USERNAMES)
assert user_list[0].name == "Cassie", user_list
assert failures == [], failures

@pytest.mark.filterwarnings("ignore:This method is deprecated, use bulk_add instead")
def test_get_users_from_file(self):
with open(ADD_XML, "rb") as f:
response_xml = f.read().decode("utf-8")
with requests_mock.mock() as m:
m.post(self.server.users.baseurl, text=response_xml)
users, failures = self.server.users.create_from_file(USERS)
with pytest.warns(DeprecationWarning, match="This method is deprecated, use bulk_add instead"):
users, failures = self.server.users.create_from_file(USERS)
assert users[0].name == "Cassie", users
assert failures == []

Expand Down

0 comments on commit 0e7602a

Please sign in to comment.