Commit bf35957f by David Robinson

Changed name and folder of package to 'parse_rest' to conform with pep8…

Changed name and folder of package to 'parse_rest' to conform with pep8 standards, along with associated tests.
parent c321554c
...@@ -6,7 +6,7 @@ import unittest ...@@ -6,7 +6,7 @@ import unittest
import urllib2 import urllib2
import datetime import datetime
import __init__ as parse import __init__ as parse_rest
try: try:
import settings_local import settings_local
...@@ -15,14 +15,14 @@ except ImportError: ...@@ -15,14 +15,14 @@ except ImportError:
'You must create a settings_local.py file with an example application to run tests' 'You must create a settings_local.py file with an example application to run tests'
) )
parse.APPLICATION_ID = settings_local.APPLICATION_ID parse_rest.APPLICATION_ID = settings_local.APPLICATION_ID
parse.API_KEY = settings_local.API_KEY parse_rest.API_KEY = settings_local.API_KEY
### FUNCTIONS ### ### FUNCTIONS ###
def test_obj(saved=False): def test_obj(saved=False):
"""Return a test parse.Object (content is from the docs)""" """Return a test parse_rest.Object (content is from the docs)"""
ret = parse.Object("GameScore") ret = parse_rest.Object("GameScore")
ret.score = 1337 ret.score = 1337
ret.playerName = "Sean Plott" ret.playerName = "Sean Plott"
ret.cheatMode = False ret.cheatMode = False
...@@ -35,8 +35,8 @@ def test_obj(saved=False): ...@@ -35,8 +35,8 @@ def test_obj(saved=False):
### CLASSES ### ### CLASSES ###
class TestObjectAndQuery(unittest.TestCase): class TestObjectAndQuery(unittest.TestCase):
""" """
Tests for the parse.Object interface for creating and updating Parse Tests for the parse_rest.Object interface for creating and updating Parse
objects, as well as the parse.ObjectQuery interface for retrieving them objects, as well as the parse_rest.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.ObjectQuery('GameScore') query = parse_rest.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.ObjectQuery("GameScore") query = parse_rest.ObjectQuery("GameScore")
o2 = query.get(o.objectId()) o2 = query.get(o.objectId())
self.assertEqual(o2.score, 1338) self.assertEqual(o2.score, 1338)
...@@ -106,12 +106,12 @@ class TestObjectAndQuery(unittest.TestCase): ...@@ -106,12 +106,12 @@ class TestObjectAndQuery(unittest.TestCase):
def test_relationship(self): def test_relationship(self):
"""Test relationship between objects""" """Test relationship between objects"""
post = parse.Object("Post") post = parse_rest.Object("Post")
post.title = "I'm Hungry" post.title = "I'm Hungry"
post.content = "Where should we go for lunch?" post.content = "Where should we go for lunch?"
post.save() post.save()
comment = parse.Object("Comment") comment = parse_rest.Object("Comment")
comment.content = "Let's do Sushirrito" comment.content = "Let's do Sushirrito"
comment.parent = post comment.parent = post
comment.save() comment.save()
...@@ -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.ObjectQuery("Post").get(post_id) post2 = parse_rest.ObjectQuery("Post").get(post_id)
comment2 = parse.ObjectQuery("Comment").get(comment_id) comment2 = parse_rest.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,11 +134,11 @@ class TestObjectAndQuery(unittest.TestCase): ...@@ -134,11 +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.ObjectQuery("GameScore").get(obj_id) o2 = parse_rest.ObjectQuery("GameScore").get(obj_id)
self.check_test_obj(o2) self.check_test_obj(o2)
o2.delete() o2.delete()
self.assertRaises(urllib2.HTTPError, self.assertRaises(urllib2.HTTPError,
parse.ObjectQuery("GameScore").get, obj_id) parse_rest.ObjectQuery("GameScore").get, obj_id)
if __name__ == "__main__": if __name__ == "__main__":
......
from distutils.core import setup from distutils.core import setup
setup( setup(
name='ParsePy', name='parse_rest',
version='0.0.2012', version='0.0.2012',
description='A client library for Parse.com\'.s REST API', description='A client library for Parse.com\'.s REST API',
url='https://github.com/dgrtwo/ParsePy', url='https://github.com/dgrtwo/ParsePy',
packages=['parse'], packages=['parse_rest'],
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'Environment :: Web Environment', 'Environment :: Web Environment',
......
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