def test_rss_is_parseable(self): """The rss feed should be a parseable feed.""" [make_bookmark() for i in range(10)] transaction.commit() res = self.app.get('/rss') eq_(res.status, "200 OK", msg='recent status is 200, ' + res.status) # http://packages.python.org/feedparser/ # introduction.html#parsing-a-feed-from-a-string parsed = feedparser.parse(res.body) links = [] for entry in parsed.entries: links.append({ 'title': entry.title, 'category': entry.category, 'date': time.strftime('%d %b %Y', entry.updated_parsed), 'description': entry.description, 'link': entry.link, }) ok_(links, 'The feed should have a list of links.') eq_(10, len(links), 'There are 10 links in the feed.') sample_item = links[0] ok_(sample_item['title'], 'Items have a title.') ok_(sample_item['link'], 'Items have a link to reach things.') ok_('description' in sample_item, 'Items have a description string.')
def test_user_delete(self): """Verify we can remove a user and their bookmarks via api.""" bob = factory.make_user(username='******') bob.activation = Activation('signup') factory.make_bookmark(user=bob) transaction.commit() res = self.testapp.delete( '/api/v1/a/users/delete/{0}?api_key={1}'.format( 'bob', self.api_key), status=200) # we should get back dict of count, users. data = json.loads(res.body) ok_(data.get('success')) # Verify that we have no bookmark for the user any longer. bmarks = Bmark.query.filter(Bmark.username == 'bob').all() eq_(0, len(bmarks))
def test_user_delete(self): """Verify we can remove a user and their bookmarks via api.""" bob = factory.make_user(username=u'bob') bob.activation = Activation(u'signup') factory.make_bookmark(user=bob) transaction.commit() res = self.testapp.delete( '/api/v1/a/users/delete/{0}?api_key={1}'.format( 'bob', self.api_key), status=200) # we should get back dict of count, users. data = json.loads(res.body) self.assertTrue(data.get('success')) # Verify that we have no bookmark for the user any longer. bmarks = Bmark.query.filter(Bmark.username == u'bob').all() self.assertEqual(0, len(bmarks))