Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ParsePy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ParsePy
Commits
cdb18bd6
Commit
cdb18bd6
authored
Apr 15, 2015
by
David Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #108 from danrobinson/fix_tests
Fixed minor problems caused by tests
parents
560ada66
28161926
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
parse_rest/connection.py
+3
-0
parse_rest/tests.py
+8
-3
No files found.
parse_rest/connection.py
View file @
cdb18bd6
...
...
@@ -169,7 +169,10 @@ class ParseBatcher(ParseBase):
# perform the callbacks with the response data (updating the existing
# objets, etc)
for
callback
,
response
in
zip
(
callbacks
,
responses
):
if
"success"
in
response
:
callback
(
response
[
"success"
])
else
:
raise
core
.
ParseError
(
response
[
"error"
])
def
batch_save
(
self
,
objects
):
"""save a list of objects in one operation"""
...
...
parse_rest/tests.py
View file @
cdb18bd6
...
...
@@ -83,14 +83,18 @@ class TestObject(unittest.TestCase):
def
setUp
(
self
):
self
.
score
=
GameScore
(
score
=
1337
,
player_name
=
'John Doe'
,
cheat_mode
=
False
)
self
.
sao_paulo
=
City
(
name
=
'São Paulo'
,
location
=
GeoPoint
(
-
23.5
,
-
46.6167
))
self
.
collected_item
=
CollectedItem
(
type
=
"Sword"
,
isAwesome
=
True
)
def
tearDown
(
self
):
city_name
=
getattr
(
self
.
sao_paulo
,
'name'
,
None
)
game_score
=
getattr
(
self
.
score
,
'score'
,
None
)
collected_item_type
=
getattr
(
self
.
collected_item
,
'type'
,
None
)
if
city_name
:
ParseBatcher
()
.
batch_delete
(
City
.
Query
.
filter
(
name
=
city_name
))
if
game_score
:
ParseBatcher
()
.
batch_delete
(
GameScore
.
Query
.
filter
(
score
=
game_score
))
if
collected_item_type
:
ParseBatcher
()
.
batch_delete
(
CollectedItem
.
Query
.
filter
(
type
=
collected_item_type
))
def
testCanInitialize
(
self
):
self
.
assertEqual
(
self
.
score
.
score
,
1337
,
'Could not set score'
)
...
...
@@ -142,10 +146,9 @@ class TestObject(unittest.TestCase):
def
testAssociatedObject
(
self
):
"""test saving and associating a different object"""
collectedItem
=
CollectedItem
(
type
=
"Sword"
,
isAwesome
=
True
)
collectedItem
.
save
()
self
.
score
.
item
=
collectedItem
self
.
collected_item
.
save
()
self
.
score
.
item
=
self
.
collected_item
self
.
score
.
save
()
# get the object, see if it has saved
...
...
@@ -392,6 +395,8 @@ class TestFunction(unittest.TestCase):
os
.
chdir
(
cloud_function_dir
)
if
not
os
.
path
.
exists
(
"config"
):
os
.
makedirs
(
"config"
)
if
not
os
.
path
.
exists
(
"public"
):
os
.
makedirs
(
"public"
)
# write the config file
with
open
(
"config/global.json"
,
"w"
)
as
outf
:
outf
.
write
(
GLOBAL_JSON_TEXT
%
(
settings_local
.
APPLICATION_ID
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment