Skip to content

Commit

Permalink
test: test add_all and check DeprecationWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
jorwoods committed Oct 3, 2024
1 parent 274d9dc commit cfb120e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from pathlib import Path
import unittest
from unittest.mock import patch

from defusedxml.ElementTree import fromstring
import pytest
Expand Down Expand Up @@ -403,3 +404,18 @@ def test_bulk_remove(self):
with self.subTest(user=user):
name, *_ = row.split(",")
assert name == f"{user.domain_name}\\{user.name}" if user.domain_name else user.name

def test_add_all(self) -> None:
self.server.version = "2.0"
users = [
make_user("Alice", "Viewer"),
make_user("Bob", "Explorer"),
make_user("Charlie", "Creator", "SAML"),
make_user("Dave"),
]

with patch("tableauserverclient.server.endpoint.users_endpoint.Users.add", autospec=True) as mock_add:
with pytest.warns(DeprecationWarning):
self.server.users.add_all(users)

assert mock_add.call_count == len(users)

0 comments on commit cfb120e

Please sign in to comment.