def testAddingSubscriptionTwiceOnlyAddsOneRecordToDataStore(self): url = "http://example.org/atom" s = Subscription(url=url, hub="http://hub.example.org/", sourceUrl="http://example.org/", key_name=url) s.put() self.assertEquals(1, len(Subscription.find(url).fetch(1000))) s2 = Subscription(url=url, hub="http://hub.example.org/", sourceUrl="http://example.org/", key_name=url) s2.put() self.assertEquals(1, len(Subscription.find(url).fetch(1000))) self.assertEquals(1, Subscription.all().count())
def testCanDeleteFeed(self): url = "http://example.org/atom" s = streamer.Subscription(url=url, hub="http://hub.example.org/", sourceUrl="http://example.org/", key_name=url) s.put() streamer.handleDeleteSubscription(url, hubSubscriber=StubHubSubscriber()) self.assertFalse(Subscription.exists(url))
def testCanDeleteSubscription(self): url = "http://example.org/atom" s = Subscription(url=url, hub="http://hub.example.org/", sourceUrl="http://example.org/", key_name=url) s.put() self.assertTrue(Subscription.exists(url)) Subscription.deleteSubscriptionWithMatchingUrl(url) self.assertFalse(Subscription.exists(url))
def testCanTellIfFeedIsNew(self): url = "http://example.org/atom" self.assertFalse(Subscription.exists(url))
def testCanTellIfFeedIsAlreadyStored(self): url = "http://example.org/atom" s = Subscription(url=url, hub="http://hub.example.org/", sourceUrl="http://example.org/", key_name=url) s.put() self.assertTrue(Subscription.exists(url))
def setUp(self): subscriptions = Subscription.all() for subscription in subscriptions: subscription.delete()