File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
microservices/gatewayApi/tests/routes/v2 Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -145,3 +145,40 @@ def test_valid_strict_dp_upstream(client):
145145 }
146146 response = client .put ('/v2/namespaces/mytest3/gateway' , json = data )
147147 assert response .status_code == 200
148+
149+
150+ def test_key_sets_and_keys_require_tags (client ):
151+ configFile = '''
152+ key_sets:
153+ - name: my-key-set
154+ tags: ["ns.mytest", "another"]
155+ keys:
156+ - name: my-key
157+ tags: ["ns.mytest", "another"]
158+ '''
159+
160+ data = {
161+ "configFile" : configFile ,
162+ "dryRun" : True
163+ }
164+ response = client .put ('/v2/namespaces/mytest/gateway' , json = data )
165+ assert response .status_code == 200
166+
167+
168+ def test_key_sets_and_keys_invalid_tags (client ):
169+ configFile = '''
170+ key_sets:
171+ - name: my-key-set
172+ tags: ["ns.other", "another"]
173+ keys:
174+ - name: my-key
175+ tags: ["ns.mytest", "another"]
176+ '''
177+
178+ data = {
179+ "configFile" : configFile ,
180+ "dryRun" : True
181+ }
182+ response = client .put ('/v2/namespaces/mytest/gateway' , json = data )
183+ assert response .status_code == 400
184+ assert "invalid ns tag ns.other" in json .dumps (response .json )
You can’t perform that action at this time.
0 commit comments