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
c321554c
Commit
c321554c
authored
Jan 11, 2013
by
David Robinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed Query to ObjectQuery in a few locations, especially in tests.py
parent
949881c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
parse/__init__.py
+1
-1
parse/tests.py
+8
-7
No files found.
parse/__init__.py
View file @
c321554c
...
@@ -232,7 +232,7 @@ class Object(ParseResource):
...
@@ -232,7 +232,7 @@ class Object(ParseResource):
if
type
(
value
)
==
dict
and
'__type'
in
value
:
if
type
(
value
)
==
dict
and
'__type'
in
value
:
if
value
[
'__type'
]
==
'Pointer'
:
if
value
[
'__type'
]
==
'Pointer'
:
value
=
Query
(
value
[
'className'
])
.
get
(
value
[
'objectId'
])
value
=
Object
Query
(
value
[
'className'
])
.
get
(
value
[
'objectId'
])
elif
value
[
'__type'
]
==
'Date'
:
elif
value
[
'__type'
]
==
'Date'
:
value
=
self
.
_ISO8601ToDatetime
(
value
[
'iso'
])
value
=
self
.
_ISO8601ToDatetime
(
value
[
'iso'
])
elif
value
[
'__type'
]
==
'Bytes'
:
elif
value
[
'__type'
]
==
'Bytes'
:
...
...
parse/tests.py
View file @
c321554c
...
@@ -36,7 +36,7 @@ def test_obj(saved=False):
...
@@ -36,7 +36,7 @@ def test_obj(saved=False):
class
TestObjectAndQuery
(
unittest
.
TestCase
):
class
TestObjectAndQuery
(
unittest
.
TestCase
):
"""
"""
Tests for the parse.Object interface for creating and updating Parse
Tests for the parse.Object interface for creating and updating Parse
objects, as well as the parse.Query interface for retrieving them
objects, as well as the parse.
Object
Query interface for retrieving them
"""
"""
def
check_test_obj
(
self
,
o
):
def
check_test_obj
(
self
,
o
):
...
@@ -57,7 +57,7 @@ class TestObjectAndQuery(unittest.TestCase):
...
@@ -57,7 +57,7 @@ class TestObjectAndQuery(unittest.TestCase):
self
.
check_test_obj
(
gameScore
)
self
.
check_test_obj
(
gameScore
)
# retrieve a new one
# retrieve a new one
query
=
parse
.
Query
(
'GameScore'
)
query
=
parse
.
Object
Query
(
'GameScore'
)
obj1
=
query
.
get
(
gameScore
.
objectId
())
obj1
=
query
.
get
(
gameScore
.
objectId
())
self
.
check_test_obj
(
obj1
)
self
.
check_test_obj
(
obj1
)
...
@@ -94,7 +94,7 @@ class TestObjectAndQuery(unittest.TestCase):
...
@@ -94,7 +94,7 @@ class TestObjectAndQuery(unittest.TestCase):
o
.
increment
(
"score"
)
o
.
increment
(
"score"
)
self
.
assertEqual
(
o
.
score
,
1338
)
self
.
assertEqual
(
o
.
score
,
1338
)
query
=
parse
.
Query
(
"GameScore"
)
query
=
parse
.
Object
Query
(
"GameScore"
)
o2
=
query
.
get
(
o
.
objectId
())
o2
=
query
.
get
(
o
.
objectId
())
self
.
assertEqual
(
o2
.
score
,
1338
)
self
.
assertEqual
(
o2
.
score
,
1338
)
...
@@ -123,8 +123,8 @@ class TestObjectAndQuery(unittest.TestCase):
...
@@ -123,8 +123,8 @@ class TestObjectAndQuery(unittest.TestCase):
self
.
assertEqual
(
comment_id
.
__class__
,
unicode
)
self
.
assertEqual
(
comment_id
.
__class__
,
unicode
)
# retrieve new ones
# retrieve new ones
post2
=
parse
.
Query
(
"Post"
)
.
get
(
post_id
)
post2
=
parse
.
Object
Query
(
"Post"
)
.
get
(
post_id
)
comment2
=
parse
.
Query
(
"Comment"
)
.
get
(
comment_id
)
comment2
=
parse
.
Object
Query
(
"Comment"
)
.
get
(
comment_id
)
# check the relationship between the saved post and comment
# check the relationship between the saved post and comment
self
.
assertEqual
(
comment2
.
parent
.
objectId
(),
post_id
)
self
.
assertEqual
(
comment2
.
parent
.
objectId
(),
post_id
)
self
.
assertEqual
(
comment2
.
parent
.
title
,
"I'm Hungry"
)
self
.
assertEqual
(
comment2
.
parent
.
title
,
"I'm Hungry"
)
...
@@ -134,10 +134,11 @@ class TestObjectAndQuery(unittest.TestCase):
...
@@ -134,10 +134,11 @@ class TestObjectAndQuery(unittest.TestCase):
o
=
test_obj
(
True
)
o
=
test_obj
(
True
)
obj_id
=
o
.
objectId
()
obj_id
=
o
.
objectId
()
self
.
check_test_obj
(
o
)
self
.
check_test_obj
(
o
)
o2
=
parse
.
Query
(
"GameScore"
)
.
get
(
obj_id
)
o2
=
parse
.
Object
Query
(
"GameScore"
)
.
get
(
obj_id
)
self
.
check_test_obj
(
o2
)
self
.
check_test_obj
(
o2
)
o2
.
delete
()
o2
.
delete
()
self
.
assertRaises
(
urllib2
.
HTTPError
,
parse
.
Query
(
"GameScore"
)
.
get
,
obj_id
)
self
.
assertRaises
(
urllib2
.
HTTPError
,
parse
.
ObjectQuery
(
"GameScore"
)
.
get
,
obj_id
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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