-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #534 from leancloud/include-file-url
fix: missing url attribute when decoding file object
- Loading branch information
Showing
5 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
from leancloud import Query | ||
from leancloud import Object | ||
from leancloud import GeoPoint | ||
from leancloud.file_ import File | ||
|
||
__author__ = "asaka <[email protected]>" | ||
|
||
|
@@ -68,6 +69,9 @@ def setup_func(): | |
game_score.set("playerName", "张三") | ||
game_score.set("location", GeoPoint(latitude=i, longitude=-i)) | ||
game_score.set("random", random.randrange(100)) | ||
f = File("Blah.txt", open("tests/sample_text.txt", "rb")) | ||
f.save() | ||
game_score.set("attachment", f) | ||
game_score.save() | ||
|
||
return setup_func | ||
|
@@ -468,6 +472,12 @@ def test_include(): # type: () -> None | |
result = Query(GameScore).include(["score"]).find() | ||
assert len(result) == 10 | ||
|
||
@with_setup(make_setup_func()) | ||
def test_attachment(): # type: () -> None | ||
result = Query(GameScore).first() | ||
print(result.dump()) | ||
attachment = result.get('attachment') | ||
assert attachment.url | ||
|
||
@with_setup(make_setup_func()) | ||
def test_select(): # type: () -> None | ||
|