Commit c321554c by David Robinson

Changed Query to ObjectQuery in a few locations, especially in tests.py

parent 949881c0
...@@ -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 = ObjectQuery(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':
......
...@@ -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.ObjectQuery 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.ObjectQuery('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.ObjectQuery("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.ObjectQuery("Post").get(post_id)
comment2 = parse.Query("Comment").get(comment_id) comment2 = parse.ObjectQuery("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.ObjectQuery("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__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment