mirror of
https://github.com/viq/NewsBlur.git
synced 2025-11-01 09:09:16 +00:00
Updating all unit tests. So far Reader and Feed import pass. Still need to fix RSS feeds.
This commit is contained in:
parent
96d8283ed0
commit
ad4bc10c92
5 changed files with 30 additions and 264 deletions
|
|
@ -53,11 +53,11 @@ class ImportTest(TestCase):
|
|||
xml = f.read()
|
||||
f.close()
|
||||
|
||||
reader_importer = GoogleReaderImporter(user)
|
||||
reader_importer = GoogleReaderImporter(user, xml=xml)
|
||||
reader_importer.import_feeds()
|
||||
|
||||
subs = UserSubscription.objects.filter(user=user)
|
||||
self.assertEquals(subs.count(), 66)
|
||||
|
||||
usf = UserSubscriptionFolders.objects.get(user=user)
|
||||
self.assertEquals(json.decode(usf.folders), [{u'Blogs \u2014 The Bloglets': [6, 16, 22, 35, 51, 56]}, {u'Blogs': [1, 3, 25, 29, 30, 39, 40, 41, 50, 55, 57, 58, 59, 60, 66]}, {u'Cooking': [11, 15, 42, 43, 46]}, {u'New York': [7, 8, 17, 18, 19, 36, 45, 47, 52, 61]}, {u'Tech': [2, 4, 9, 10, 12, 13, 14, 20, 23, 24, 26, 27, 28, 31, 32, 33, 34, 48, 49, 62, 64]}, {u'Blogs \u2014 Tumblrs': [5, 21, 37, 38, 53, 54, 63, 65]}, 44])
|
||||
self.assertEquals(json.decode(usf.folders), [{'Blogs \xe2\x80\x94 The Bloglets': [6, 16, 22, 35, 51, 56]}, {'Blogs': [1, 3, 25, 29, 30, 39, 40, 41, 50, 55, 57, 58, 59, 60, 66]}, {'Cooking': [11, 15, 42, 43, 46]}, {'New York': [7, 8, 17, 18, 19, 36, 45, 47, 52, 61]}, {'Tech': [2, 4, 9, 10, 12, 13, 14, 20, 23, 24, 26, 27, 28, 31, 32, 33, 34, 48, 49, 62, 64]}, {'Blogs \xe2\x80\x94 Tumblrs': [5, 21, 37, 38, 53, 54, 63, 65]}, 44])
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
"pk": 1,
|
||||
"model": "reader.usersubscriptionfolders",
|
||||
"fields": {
|
||||
"folders": "[1, {\"Tech\": [4, 5, {\"Deep Tech\": [6, 7]}]}, 2, 3, {\"Blogs\": [8, 9]}]",
|
||||
"folders": "[1, {\"Tech\": [4, 5, {\"Deep Tech\": [6, 7]}]}, 2, 3, 8, 9, {\"Blogs\": [8, 9]}]",
|
||||
"user": 1
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,223 +0,0 @@
|
|||
[
|
||||
{
|
||||
"pk": 15531,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-29 00:23:19",
|
||||
"story_guid_hash": "3f2d860040eac196b1c8768aa2915d8b",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://weblog.muledesign.com/2010/06/apples_apostrophe_bait_and_swi.php",
|
||||
"story_title": "Apple\u2019s Apostrophe Bait and Switch",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20318",
|
||||
"story_content": "<p>Mike Monteiro on the iOS 4 keyboard’s apostrophe key. I disagree slightly with his suggestion to Apple; rather than make the key default to an apostrophe, they should add “Smart Quotes” to iOS and turn it on by default. Flipping single and double quotes the right way is not a hard problem to solve. Even <a href=\"http://daringfireball.net/projects/smartypants/\">I can do it</a>.</p>\n\n<p>The use of primes and double primes in lieu of proper apostrophes and quotation marks is far more glaring on the Retina Display than before.</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/monteiro-apostrophe\" title=\"Permanent link to \u2018Apple\u2019s Apostrophe Bait and Switch\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15532,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-29 00:15:52",
|
||||
"story_guid_hash": "a46dd4357ae5d9b3e3590f3038bbc022",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://vimeo.com/12864890",
|
||||
"story_title": "The Spot",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20317",
|
||||
"story_content": "<p>Cameron Hunt demonstrates the magic spot on his iPhone 4 on which, if he places a finger, 3G reception stops.</p>\n\n<p><strong>Update:</strong> But <a href=\"http://twitter.com/camh/status/17297671186\">Hunt can’t reproduce the problem from every location</a>.</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/hunt-spot\" title=\"Permanent link to \u2018The Spot\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15533,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 23:18:10",
|
||||
"story_guid_hash": "9f357a531b11446ea6c78cb4c150e4f0",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://vimeo.com/12819723",
|
||||
"story_title": "\u2018Apple of My Eye\u2019",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20316",
|
||||
"story_content": "<p>Short film by Michael Koerbel, shot <em>and edited</em> entirely on an iPhone 4. Someone apparently forgot to send him the memo that iOS devices are only for consumption, not creation.</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/apple-of-my-eye\" title=\"Permanent link to \u2018‘Apple of My Eye’\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15534,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 23:10:27",
|
||||
"story_guid_hash": "0005cc3edd30bed865b70a6ee657742e",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://news.cnet.com/8301-13860_3-20009078-56.html",
|
||||
"story_title": "Microsoft\u2019s Windows 8 Game Plan Leaked",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20315",
|
||||
"story_content": "<p>So I guess their plan is to get Scott Forstall to do a “Windows 8 was my idea” commercial.</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/windows-8\" title=\"Permanent link to \u2018Microsoft’s Windows 8 Game Plan Leaked\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15535,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 22:21:04",
|
||||
"story_guid_hash": "f66dbfde20370000e7c7e1f950c4a392",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://speedbird.wordpress.com/2010/06/25/what-apple-needs-to-do-now/",
|
||||
"story_title": "Adam Greenfield on Apple\u2019s Infatuation With Skeuomorphic Graphic Design",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20314",
|
||||
"story_content": "<p>Adam Greenfield:</p>\n\n<blockquote>\n <p>I\u2019m talking about the persistent <a href=\"http://en.wikipedia.org/wiki/Skeuomorph\">skeuomorphic</a> design cues that\n spoor applications like Calendar, Compass, iBooks and the truly\n awful Notes. The iPhone and iPad, as I argued on the launch of the\n original in 2007, are history\u2019s first full-fledged everyware\n devices — post-PC interface devices of enormous power and grace\n — and here somebody in Apple\u2019s UX shop has saddled them with\n the most awful and mawkish and flat-out <em>tacky</em> visual cues. You can\n credibly accuse Cupertino of any number of sins over the course of\n the last thirty years, but tackiness has not ordinarily numbered\n among them.</p>\n</blockquote>\n\n<p>This trend used to bother me as well, but I’ve grown to accept it. I think the trick is in doing it well — when it is, it makes people happy. I like the iPad Calendar app, for example. What I don’t understand is Apple’s lack of consistency in this regard. Why does the iPad Calendar app get the skeuomorphic treatment but not the iPhone version? (Notes, for example, gets it in both.)</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/greenfield\" title=\"Permanent link to \u2018Adam Greenfield on Apple’s Infatuation With Skeuomorphic Graphic Design\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15536,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 21:18:49",
|
||||
"story_guid_hash": "69199e0ce33949d424f4e340231c16ea",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://www.youtube.com/watch%253Fv%253D-CVYOCMpJRY",
|
||||
"story_title": "\u2018AT-AT Day Afternoon\u2019",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20313",
|
||||
"story_content": "<p>Lovely short film by Patrick Boivin.</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/atat-day-afternoon\" title=\"Permanent link to \u2018‘AT-AT Day Afternoon’\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15537,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 21:08:37",
|
||||
"story_guid_hash": "ea39aa9f9bf1208f76d7537a387888ad",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://newyorker.tumblr.com/post/745982200/in-this-weeks-issue-george-packer-on-the",
|
||||
"story_title": "Great New Yorker Cover by Bob Staake",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20312",
|
||||
"story_content": "<p>Also: The New Yorker has a Tumblr site? (<a href=\"http://twitter.com/jnack/status/17278373243\">Via John Nack</a>.)</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/new-yorker-staake\" title=\"Permanent link to \u2018Great New Yorker Cover by Bob Staake\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15538,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 21:04:47",
|
||||
"story_guid_hash": "c034cda4a44d497046c2a37a33b71b8a",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://www.amazon.com/gp/feature.html/ref%253Dred_lnd_shrt_url%253Fie%253DUTF8%2526docId%253D165849822",
|
||||
"story_title": "Kindle for Android",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20311",
|
||||
"story_content": "<p>Looks very much like Kindle for iPhone (but without, for now, <a href=\"http://daringfireball.net/linked/2010/06/28/amazon-kindle-ios\">the just-announced audio/video support</a>).</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/kindle-android\" title=\"Permanent link to \u2018Kindle for Android\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15539,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 19:35:41",
|
||||
"story_guid_hash": "54c7069bc0e1e5d4494710728e19079f",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://www.macworld.com/article/152358/2010/06/copy_imovies2ipad.html",
|
||||
"story_title": "Copy iPhone 4\u2019s iMovies to iPad Via Camera Connection Kit",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20310",
|
||||
"story_content": "<p>Great idea; too bad the Camera Connection Kit still shows 4-6 weeks for delivery <a href=\"http://store.apple.com/us/product/MC531ZM/A?fnode=MTc0MjU4NjE&mco=MTc0NzE1OTE\">from Apple’s online store</a>.</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/imovie-to-ipad\" title=\"Permanent link to \u2018Copy iPhone 4’s iMovies to iPad Via Camera Connection Kit\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15540,
|
||||
"model": "rss_feeds.story",
|
||||
"fields": {
|
||||
"story_original_content": null,
|
||||
"story_date": "2010-06-28 19:22:35",
|
||||
"story_guid_hash": "c05cbae2a54961c7716896b34b301564",
|
||||
"story_feed": 56,
|
||||
"story_content_type": null,
|
||||
"story_tags": "[]",
|
||||
"story_permalink": "http://www.youtube.com/watch%253Fv%253DgOnC5chCag0",
|
||||
"story_title": "The iPhone 4 FaceTime Ad Isn\u2019t the Only Smartphone Ad That\u2019ll Make You Tear Up",
|
||||
"story_guid": "tag:daringfireball.net,2010:/linked//6.20309",
|
||||
"story_content": "<p>Verizon’s new Droid X spot makes my eyes feel funny, too.</p>\n\n<div>\n<a href=\"http://daringfireball.net/linked/2010/06/28/droid-x-ad\" title=\"Permanent link to \u2018The iPhone 4 FaceTime Ad Isn’t the Only Smartphone Ad That’ll Make You Tear Up\u2019\"> \u2605 </a>\n</div>",
|
||||
"story_past_trim_date": false,
|
||||
"tags": [],
|
||||
"story_author": 107
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 56,
|
||||
"model": "rss_feeds.feed",
|
||||
"fields": {
|
||||
"feed_address": "http://daringfireball.net/index.xml",
|
||||
"creation": "2010-02-02",
|
||||
"days_to_trim": 90,
|
||||
"feed_link": "http://daringfireball.net/",
|
||||
"num_subscribers": 7,
|
||||
"min_to_decay": 15,
|
||||
"feed_title": "Daring Fireball",
|
||||
"last_update": "2010-06-29 08:56:41",
|
||||
"feed_tagline": "Mac and web curmudgeonry/nerdery. By John Gruber.",
|
||||
"next_scheduled_update": "2010-06-29 10:13:23",
|
||||
"etag": "\"87f7c956795870fa380be53674d39fda\"-gzip",
|
||||
"last_modified": "2010-06-29 03:28:00",
|
||||
"last_load_time": 10,
|
||||
"active": true,
|
||||
"stories_last_month": 217,
|
||||
"popular_tags": "[]",
|
||||
"popular_authors": "[]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 107,
|
||||
"model": "rss_feeds.storyauthor",
|
||||
"fields": {
|
||||
"feed": 56,
|
||||
"author_name": "John Gruber"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -315,7 +315,7 @@ class UserSubscriptionFolders(models.Model):
|
|||
(folder_name == in_folder and deleted))):
|
||||
multiples_found = True
|
||||
logging.user(self.user, "~FB~SBDeleting feed, and a multiple has been found in '%s'" % (folder_name))
|
||||
if folder == feed_id and (folder_name == in_folder or not folder_name) and not deleted:
|
||||
if folder == feed_id and (folder_name == in_folder) and not deleted:
|
||||
logging.user(self.user, "~FBDelete feed: %s'th item: %s folders/feeds" % (
|
||||
k, len(old_folders)
|
||||
))
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
from utils import json_functions as json
|
||||
from django.test.client import Client
|
||||
from django.test import TestCase
|
||||
from django.core import management
|
||||
from pprint import pprint
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
class ReaderTest(TestCase):
|
||||
fixtures = ['reader.json', 'stories.json']
|
||||
fixtures = ['reader.json', 'stories.json', '../../rss_feeds/fixtures/gawker1.json']
|
||||
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
|
|
@ -15,84 +13,75 @@ class ReaderTest(TestCase):
|
|||
self.client.login(username='conesus', password='test')
|
||||
|
||||
response = self.client.get(reverse('load-feeds'))
|
||||
pprint(json.decode(response.content))
|
||||
content = json.decode(response.content)
|
||||
|
||||
self.assertEquals(len(content['feeds']), 1)
|
||||
self.assertEquals(content['feeds']['1']['feed_title'], 'Gawker')
|
||||
self.assertEquals(content['folders'], [1, {'Tech': [4, 5, {'Deep Tech': [6, 7]}]}, 2, 3, 8, 9, {'Blogs': [8, 9]}])
|
||||
|
||||
def test_delete_feed(self):
|
||||
self.client.login(username='conesus', password='test')
|
||||
|
||||
response = self.client.get(reverse('load-feeds'))
|
||||
feeds = json.decode(response.content)
|
||||
self.assertEquals(len(feeds['folders']), 5)
|
||||
self.assertTrue(1 in feeds['folders'])
|
||||
self.assertEquals(feeds['folders'], [1, {u'Tech': [4, 5, {u'Deep Tech': [6, 7]}]}, 2, 3, {u'Blogs': [8, 9]}])
|
||||
self.assertEquals(feeds['folders'], [1, {'Tech': [4, 5, {'Deep Tech': [6, 7]}]}, 2, 3, 8, 9, {'Blogs': [8, 9]}])
|
||||
|
||||
# Delete feed
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 1})
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 1, 'in_folder': ''})
|
||||
response = json.decode(response.content)
|
||||
self.assertEquals(response['code'], 1)
|
||||
|
||||
response = self.client.get(reverse('load-feeds'))
|
||||
feeds = json.decode(response.content)
|
||||
self.assertEquals(len(feeds['folders']), 4)
|
||||
self.assertTrue(1 not in feeds['folders'])
|
||||
self.assertEquals(feeds['folders'], [{u'Tech': [4, 5, {u'Deep Tech': [6, 7]}]}, 2, 3, {u'Blogs': [8, 9]}])
|
||||
self.assertEquals(feeds['folders'], [{'Tech': [4, 5, {'Deep Tech': [6, 7]}]}, 2, 3, 8, 9, {'Blogs': [8, 9]}])
|
||||
|
||||
# Delete feed
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 9})
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 9, 'in_folder': 'Blogs'})
|
||||
response = json.decode(response.content)
|
||||
self.assertEquals(response['code'], 1)
|
||||
|
||||
response = self.client.get(reverse('load-feeds'))
|
||||
feeds = json.decode(response.content)
|
||||
self.assertEquals(len(feeds['folders']), 4)
|
||||
self.assertTrue(1 not in feeds['folders'])
|
||||
self.assertEquals(feeds['folders'], [{u'Tech': [4, 5, {u'Deep Tech': [6, 7]}]}, 2, 3, {u'Blogs': [8]}])
|
||||
self.assertEquals(feeds['folders'], [{'Tech': [4, 5, {'Deep Tech': [6, 7]}]}, 2, 3, 8, 9, {'Blogs': [8]}])
|
||||
|
||||
# Delete feed
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 5})
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 5, 'in_folder': 'Tech'})
|
||||
response = json.decode(response.content)
|
||||
self.assertEquals(response['code'], 1)
|
||||
|
||||
response = self.client.get(reverse('load-feeds'))
|
||||
feeds = json.decode(response.content)
|
||||
self.assertEquals(len(feeds['folders']), 4)
|
||||
self.assertTrue(1 not in feeds['folders'])
|
||||
self.assertEquals(feeds['folders'], [{u'Tech': [4, {u'Deep Tech': [6, 7]}]}, 2, 3, {u'Blogs': [8]}])
|
||||
self.assertEquals(feeds['folders'], [{'Tech': [4, {'Deep Tech': [6, 7]}]}, 2, 3, 8, 9, {'Blogs': [8]}])
|
||||
|
||||
# Delete feed
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 4})
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 4, 'in_folder': 'Tech'})
|
||||
response = json.decode(response.content)
|
||||
self.assertEquals(response['code'], 1)
|
||||
|
||||
response = self.client.get(reverse('load-feeds'))
|
||||
feeds = json.decode(response.content)
|
||||
self.assertEquals(len(feeds['folders']), 4)
|
||||
self.assertTrue(1 not in feeds['folders'])
|
||||
self.assertEquals(feeds['folders'], [{u'Tech': [{u'Deep Tech': [6, 7]}]}, 2, 3, {u'Blogs': [8]}])
|
||||
self.assertEquals(feeds['folders'], [{'Tech': [{'Deep Tech': [6, 7]}]}, 2, 3, 8, 9, {'Blogs': [8]}])
|
||||
|
||||
# Delete feed
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 8})
|
||||
response = self.client.post(reverse('delete-feed'), {'feed_id': 8, 'in_folder': ''})
|
||||
response = json.decode(response.content)
|
||||
self.assertEquals(response['code'], 1)
|
||||
|
||||
response = self.client.get(reverse('load-feeds'))
|
||||
feeds = json.decode(response.content)
|
||||
self.assertEquals(len(feeds['folders']), 4)
|
||||
self.assertTrue(1 not in feeds['folders'])
|
||||
self.assertEquals(feeds['folders'], [{u'Tech': [{u'Deep Tech': [6, 7]}]}, 2, 3, {u'Blogs': []}])
|
||||
self.assertEquals(feeds['folders'], [{'Tech': [{'Deep Tech': [6, 7]}]}, 2, 3, 9, {'Blogs': [8]}])
|
||||
|
||||
def test_load_single_feed(self):
|
||||
from django.conf import settings
|
||||
from django.db import connection
|
||||
settings.DEBUG = True
|
||||
connection.queries = []
|
||||
# from django.conf import settings
|
||||
# from django.db import connection
|
||||
# settings.DEBUG = True
|
||||
# connection.queries = []
|
||||
|
||||
self.client.login(username='conesus', password='test')
|
||||
response = self.client.get(reverse('load-single-feed'), {'feed_id': 56})
|
||||
response = self.client.get(reverse('load-single-feed', args=[1]))
|
||||
feed = json.decode(response.content)
|
||||
self.assertEquals(len(feed['feed_tags']), 0)
|
||||
self.assertEquals(len(feed['classifiers']['tags']), 0)
|
||||
# self.assert_(connection.queries)
|
||||
|
||||
pprint(connection.queries)
|
||||
|
||||
self.assert_(connection.queries)
|
||||
|
||||
settings.DEBUG = False
|
||||
# settings.DEBUG = False
|
||||
Loading…
Add table
Reference in a new issue