File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5757 pip install -e .'[test]'
5858 - name : Run tests with ${{ matrix.python-version }}
5959 env :
60- APP_ID : 8FfQwpvihLHK4htqmtEvkNrv
61- APP_KEY : eE9tNOcCiWoMHM1phxY41rAz
62- MASTER_KEY : 75zAjEJSj7lifKQqKSTryae9
60+ APP_ID : YJRGphy60b8JCBib0vtDDtak-MdYXbMMI
61+ APP_KEY : ${{ secrets.APP_KEY }}
62+ MASTER_KEY : ${{ secrets.MASTER_KEY }}
6363 USE_REGION : US
6464 run :
6565 nosetests -v
Original file line number Diff line number Diff line change @@ -45,6 +45,22 @@ Configure the following environment variables:
4545- ` MASTER_KEY `
4646- ` USE_REGION `
4747
48+ Make sure the following options are configured on the LeanCloud console:
49+
50+ - Data Storage > Settings > Include ACL with objects being queried: ** checked**
51+ - Push Notification > Push notification settings > Prevent clients from sending push notifications: ** unchecked**
52+ - Settings > Security > Service switches > Push notifications: ** enabled**
53+ - Settings > Security > Service switches > SMS: ** disabled**
54+
55+ And there is a cloud function naming ` add ` which returns ` 3 ` for ` add(a=1, b=2) ` deployed on the LeanEngine production environment of the application.
56+ For example:
57+
58+ ``` js
59+ AV .Cloud .define (' add' , async function (request ) {
60+ return request .params [" a" ] + request .params [" b" ]
61+ })
62+ ```
63+
4864Install dependencies:
4965
5066``` sh
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ def decode(key, value):
140140 if meta_data :
141141 f ._metadata = meta_data
142142 f ._url = value ["url" ]
143+ f ._successful_url = value ["url" ]
143144 f .id = value ["objectId" ]
144145 return f
145146
Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ def test_save_with_specified_key(): # type: () -> None
123123 path = urlparse (f .url ).path
124124 if path .startswith ("/avos-cloud-" ): # old school aws s3 file url
125125 assert path .split ("/" )[2 ] == user_specified_key
126+ elif f .url .startswith ("https://lc-gluttony" ): # new aws s3 gluttony bucket
127+ gluttony_path = "/" + os .environ ["APP_ID" ][0 :12 ] + "/" + user_specified_key
128+ assert path == gluttony_path
126129 else :
127130 assert path == "/" + user_specified_key
128131
Original file line number Diff line number Diff line change 1717from leancloud import Query
1818from leancloud import Object
1919from leancloud import GeoPoint
20+ from leancloud .file_ import File
2021
2122__author__ = "asaka <lan@leancloud.rocks>"
2223
@@ -68,6 +69,9 @@ def setup_func():
6869 game_score .set ("playerName" , "张三" )
6970 game_score .set ("location" , GeoPoint (latitude = i , longitude = - i ))
7071 game_score .set ("random" , random .randrange (100 ))
72+ f = File ("Blah.txt" , open ("tests/sample_text.txt" , "rb" ))
73+ f .save ()
74+ game_score .set ("attachment" , f )
7175 game_score .save ()
7276
7377 return setup_func
@@ -468,6 +472,12 @@ def test_include(): # type: () -> None
468472 result = Query (GameScore ).include (["score" ]).find ()
469473 assert len (result ) == 10
470474
475+ @with_setup (make_setup_func ())
476+ def test_attachment (): # type: () -> None
477+ result = Query (GameScore ).first ()
478+ print (result .dump ())
479+ attachment = result .get ('attachment' )
480+ assert attachment .url
471481
472482@with_setup (make_setup_func ())
473483def test_select (): # type: () -> None
You can’t perform that action at this time.
0 commit comments