def testVerifyThatTweetsAreUniqueById(self): tw = {"id": 123456} self.assertEqual(len(list(Tweet.find(self.g, tw))), 0) Tweet.new(self.g, tw) self.assertEqual(len(list(Tweet.find(self.g, tw))), 1) Tweet.new(self.g, tw) self.assertEqual(len(list(Tweet.find(self.g, tw))), 1)
def testVerifyThatComplexTweetsAreUniqueById(self): tw = {"id": 123456, "text": "Hello world!"} short_tw = {"id": 123456} self.assertEqual(len(list(Tweet.find(self.g, short_tw))), 0) Tweet.new(self.g, short_tw) # Just the ID self.assertEqual(len(list(Tweet.find(self.g, short_tw))), 1) Tweet.new(self.g, tw) self.assertEqual(len(list(Tweet.find(self.g, short_tw))), 1)
def testAddTweet(self): Tweet.new(self.g, {"id": 123456})