@@ -12,7 +12,7 @@ def test_generate_tenant_token_with_search_rules(get_private_key, index_with_doc
12
12
index_with_documents ()
13
13
client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
14
14
15
- token = client .generate_tenant_token (search_rules = ["*" ])
15
+ token = client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = ["*" ])
16
16
17
17
token_client = meilisearch .Client (BASE_URL , token )
18
18
response = token_client .index ('indexUID' ).search ('' , {
@@ -28,7 +28,7 @@ def test_generate_tenant_token_with_search_rules_on_one_index(get_private_key, e
28
28
empty_index ('tenant_token' )
29
29
client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
30
30
31
- token = client .generate_tenant_token (search_rules = ['indexUID' ])
31
+ token = client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = ['indexUID' ])
32
32
33
33
token_client = meilisearch .Client (BASE_URL , token )
34
34
response = token_client .index ('indexUID' ).search ('' )
@@ -40,7 +40,7 @@ def test_generate_tenant_token_with_search_rules_on_one_index(get_private_key, e
40
40
def test_generate_tenant_token_with_api_key (client , get_private_key , empty_index ):
41
41
"""Tests create a tenant token with search rules and an api key."""
42
42
empty_index ()
43
- token = client .generate_tenant_token (search_rules = ["*" ], api_key = get_private_key ['key' ])
43
+ token = client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = ["*" ], api_key = get_private_key ['key' ])
44
44
45
45
token_client = meilisearch .Client (BASE_URL , token )
46
46
response = token_client .index ('indexUID' ).search ('' )
@@ -53,7 +53,7 @@ def test_generate_tenant_token_with_expires_at(client, get_private_key, empty_in
53
53
client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
54
54
tomorrow = datetime .datetime .utcnow () + datetime .timedelta (days = 1 )
55
55
56
- token = client .generate_tenant_token (search_rules = ["*" ], expires_at = tomorrow )
56
+ token = client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = ["*" ], expires_at = tomorrow )
57
57
58
58
token_client = meilisearch .Client (BASE_URL , token )
59
59
response = token_client .index ('indexUID' ).search ('' )
@@ -65,28 +65,28 @@ def test_generate_tenant_token_with_empty_search_rules_in_list(get_private_key):
65
65
client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
66
66
67
67
with pytest .raises (Exception ):
68
- client .generate_tenant_token (search_rules = ['' ])
68
+ client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = ['' ])
69
69
70
70
def test_generate_tenant_token_without_search_rules_in_list (get_private_key ):
71
71
"""Tests create a tenant token without search rules."""
72
72
client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
73
73
74
74
with pytest .raises (Exception ):
75
- client .generate_tenant_token (search_rules = [])
75
+ client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = [])
76
76
77
77
def test_generate_tenant_token_without_search_rules_in_dict (get_private_key ):
78
78
"""Tests create a tenant token without search rules."""
79
79
client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
80
80
81
81
with pytest .raises (Exception ):
82
- client .generate_tenant_token (search_rules = {})
82
+ client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = {})
83
83
84
84
def test_generate_tenant_token_with_empty_search_rules_in_dict (get_private_key ):
85
85
"""Tests create a tenant token without search rules."""
86
86
client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
87
87
88
88
with pytest .raises (Exception ):
89
- client .generate_tenant_token (search_rules = {'' })
89
+ client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = {'' })
90
90
91
91
def test_generate_tenant_token_with_bad_expires_at (client , get_private_key ):
92
92
"""Tests create a tenant token with a bad expires at."""
@@ -95,7 +95,7 @@ def test_generate_tenant_token_with_bad_expires_at(client, get_private_key):
95
95
yesterday = datetime .datetime .utcnow () + datetime .timedelta (days = - 1 )
96
96
97
97
with pytest .raises (Exception ):
98
- client .generate_tenant_token (search_rules = ["*" ], expires_at = yesterday )
98
+ client .generate_tenant_token (api_key_uid = get_private_key [ 'uid' ], search_rules = ["*" ], expires_at = yesterday )
99
99
100
100
def test_generate_tenant_token_with_no_api_key (client ):
101
101
"""Tests create a tenant token with no api key."""
@@ -104,3 +104,9 @@ def test_generate_tenant_token_with_no_api_key(client):
104
104
with pytest .raises (Exception ):
105
105
client .generate_tenant_token (search_rules = ["*" ])
106
106
107
+ def test_generate_tenant_token_with_no_uid (client , get_private_key ):
108
+ """Tests create a tenant token with no uid."""
109
+ client = meilisearch .Client (BASE_URL , get_private_key ['key' ])
110
+
111
+ with pytest .raises (Exception ):
112
+ client .generate_tenant_token (api_key_uid = None , search_rules = ["*" ])
0 commit comments