forked from tableau/server-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_user_model.py
More file actions
25 lines (19 loc) · 884 Bytes
/
test_user_model.py
File metadata and controls
25 lines (19 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import unittest
import tableauserverclient as TSC
class UserModelTests(unittest.TestCase):
def test_invalid_name(self):
self.assertRaises(ValueError, TSC.UserItem, None, TSC.UserItem.Roles.Publisher)
self.assertRaises(ValueError, TSC.UserItem, "", TSC.UserItem.Roles.Publisher)
user = TSC.UserItem("me", TSC.UserItem.Roles.Publisher)
with self.assertRaises(ValueError):
user.name = None
with self.assertRaises(ValueError):
user.name = ""
def test_invalid_auth_setting(self):
user = TSC.UserItem("me", TSC.UserItem.Roles.Publisher)
with self.assertRaises(ValueError):
user.auth_setting = "Hello"
def test_invalid_site_role(self):
user = TSC.UserItem("me", TSC.UserItem.Roles.Publisher)
with self.assertRaises(ValueError):
user.site_role = "Hello"