Skip to content

Commit 92f7d35

Browse files
committed
test: test add_all and check DeprecationWarning
1 parent 221d897 commit 92f7d35

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/test_user.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
from pathlib import Path
55
import unittest
6+
from unittest.mock import patch
67

78
from defusedxml.ElementTree import fromstring
89
import pytest
@@ -419,3 +420,18 @@ def test_bulk_remove(self):
419420
with self.subTest(user=user):
420421
name, *_ = row.split(",")
421422
assert name == f"{user.domain_name}\\{user.name}" if user.domain_name else user.name
423+
424+
def test_add_all(self) -> None:
425+
self.server.version = "2.0"
426+
users = [
427+
make_user("Alice", "Viewer"),
428+
make_user("Bob", "Explorer"),
429+
make_user("Charlie", "Creator", "SAML"),
430+
make_user("Dave"),
431+
]
432+
433+
with patch("tableauserverclient.server.endpoint.users_endpoint.Users.add", autospec=True) as mock_add:
434+
with pytest.warns(DeprecationWarning):
435+
self.server.users.add_all(users)
436+
437+
assert mock_add.call_count == len(users)

0 commit comments

Comments
 (0)