Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf0c5026

Browse files
committed
add 1 test case, now 55 test cases for apijson-get
1 parentdda827b commitf0c5026

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

‎tests/test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,24 @@ def test_apijson_get():
743743
>>> print(d)
744744
{'code': 400, 'msg': "model does not have this column: 'nonexist'"}
745745
746+
>>> #query array with a nonexist column
747+
>>> data ='''{
748+
... "[]":{
749+
... "@count":4,
750+
... "@page":0,
751+
... "user":{
752+
... "@column":"id,username,nickname,email",
753+
... "@order":"id-",
754+
... "@role":"ADMIN",
755+
... "nonexist":1
756+
... }
757+
... }
758+
... }'''
759+
>>> r = handler.post('/apijson/get', data=data, pre_call=pre_call_as("admin"), middlewares=[])
760+
>>> d = json_loads(r.data)
761+
>>> print(d)
762+
{'code': 400, 'msg': "non-existent column or not support item: 'nonexist'"}
763+
746764
>>> #Association query: Two tables, one to one,ref path is absolute path
747765
>>> data ='''{
748766
... "moment":{},

‎uliweb_apijson/apijson/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def _get_filter_condition(self,model,model_param,item,expr=False):
254254
elifhasattr(model,n):
255255
returngetattr(model.c,n)==model_param[n]
256256
else:
257-
raiseUliwebError("not support item: '%s'"%(item))
257+
raiseUliwebError("non-existent column ornot support item: '%s'"%(item))
258258

259259
defhead(self):
260260
try:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp