def testCreate(self): obj = User.create(User(name=self.name, email=self.name + '@teste.com', password='******')) self.assertEqual(obj.name, self.name) self.assertTrue(is_integer(obj.id), 'ID was supposed to be int. Value: %s' % str(obj.id)) try: name = 'teste&%***(9 "" ' obj = User.create(User(name=name, email=name + '@teste.com', password='******')) self.fail("Create user should not succeed with invalid data") except ValidationException, e: self.assertTrue(True)
def testCreate(self): name = 'teste_%s' % str(datetime.now()) obj = Interest.create(Interest(name=name)) self.assertEqual(obj.name, name) self.assertTrue(is_integer(obj.id), 'ID was supposed to be int. Value: %s' % str(obj.id)) try: name = 't' * 255 obj = Interest.create(Interest(name=name)) self.fail("Create interest should not succeed with invalid data") except ValidationException, e: self.assertTrue(True)
def testCreate(self): # create without location data obj = Conversation.parse({ 'interest_id' : 1, 'user_id' : 1, 'message' : "Hello there, this is just a test, ok?" }) obj = Conversation.create(obj) self.assertTrue(is_integer(obj.id)) # create a reply to the conversation above obj2 = Conversation.parse({ 'interest_id' : 1, 'user_id' : 2, 'message' : "And this is a reply.", 'lat' : -27.8738, 'lon' : -54.4761, 'parent_id' : obj.id }) obj2 = Conversation.create(obj2) self.assertTrue(is_integer(obj2.id))
def testCreate(self): obj = User.create( User(name=self.name, email=self.name + '@teste.com', password='******')) self.assertEqual(obj.name, self.name) self.assertTrue(is_integer(obj.id), 'ID was supposed to be int. Value: %s' % str(obj.id)) try: name = 'teste&%***(9 "" ' obj = User.create( User(name=name, email=name + '@teste.com', password='******')) self.fail("Create user should not succeed with invalid data") except ValidationException, e: self.assertTrue(True)
def testCountAllByUser(self): count = Conversation.countAllByUser(1) self.assertTrue(is_integer(count))
def testCountAll(self): count = Conversation.countAll() self.assertTrue(is_integer(count)) self.assertTrue(count > 0)
def testFind(self): obj = Interest.find(1) self.assertEqual(obj.name, 'Photography') self.assertTrue(is_integer(obj.id))
def testCountAllByUser(self): count = Conversation.countAll(user_id=2) self.assertTrue(is_integer(count)) self.assertTrue(count > 0)
def testCountAllAfter(self): date = datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M") count = Conversation.countAll(after=date) self.assertTrue(is_integer(count)) self.assertTrue(count > 0)
def testCountAllBySubscription(self): count = Conversation.countAllBySubscription(1) self.assertTrue(is_integer(count))
def testCountAllByInterest(self): count = Conversation.countAll(interest_id=1) self.assertTrue(is_integer(count)) self.assertTrue(count > 0)
def testCountAllByUserName(self): count = Interest.countAllByUserName('john') self.assertTrue(is_integer(count))
def testCountAllByUserName(self): count = Conversation.countAllByUserName('john') self.assertTrue(is_integer(count))
def testFindReply(self): obj = Conversation.findReply(6, 2, 7) self.assertTrue(isinstance(obj, Conversation)) self.assertTrue(is_integer(obj.id))
def testFind(self): obj = Conversation.find(1, 1) self.assertTrue(isinstance(obj, Conversation)) self.assertTrue(is_integer(obj.id))
def testFindByKey(self): app = Application.findByKey('9c7dc77314ca22b8eec94440fa528157f8b8be03') self.assertTrue(app is not None) self.assertTrue(is_integer(app.id))
def testCountAllAround(self): count = Interest.countAll(location=[-27.86403, -54.4593889], radius=20000) self.assertTrue(is_integer(count))
def testCountAll(self): count = Interest.countAll() self.assertTrue(is_integer(count))