mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
When adding a feed to a folder, check against the lower case folder name to correct for dupes.
This commit is contained in:
parent
17d7fef0e2
commit
bb089f4aeb
6 changed files with 23 additions and 21 deletions
|
@ -1,2 +1,2 @@
|
|||
exclude = '{$exclude,*.tgz,*.gz,static/*.js,static/*.css}'
|
||||
excludeDirectories = "{$excludeDirectories,logs,data,clients/android,media/fonts,node_modules,venv,fonts,clients,fixtures}"
|
||||
excludeDirectories = "{$excludeDirectories,logs,data,clients/android,media/fonts,node_modules,venv,fonts,clients}"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<outline text="very small array" description="" title="very small array" type="rss" version="RSS" htmlUrl="http://www.verysmallarray.com" xmlUrl="http://www.verysmallarray.com/?feed=rss2"/>
|
||||
<outline text="Frugal Traveler" description="" title="Frugal Traveler" type="rss" version="RSS" htmlUrl="http://frugaltraveler.blogs.nytimes.com/" xmlUrl="http://frugaltraveler.blogs.nytimes.com/feed/"/>
|
||||
</outline>
|
||||
<outline text="Tech" title="Tech">
|
||||
<outline text="tech" title="tech">
|
||||
<outline text="Joel on Software" description="" title="Joel on Software" type="rss" version="RSS" htmlUrl="http://www.joelonsoftware.com" xmlUrl="http://www.joelonsoftware.com/rss.xml"/>
|
||||
<outline text="Daring Fireball" description="" title="Daring Fireball" type="rss" version="RSS" htmlUrl="http://daringfireball.net/" xmlUrl="http://daringfireball.net/index.xml"/>
|
||||
<outline text="Techcrunch" description="" title="Techcrunch" type="rss" version="RSS" htmlUrl="http://techcrunch.com" xmlUrl="http://feeds.feedburner.com/Techcrunch"/>
|
||||
|
|
|
@ -29,6 +29,10 @@ class ImportTest(TestCase):
|
|||
subs = UserSubscription.objects.filter(user=user)
|
||||
self.assertEquals(subs.count(), 54)
|
||||
|
||||
usf = UserSubscriptionFolders.objects.get(user=user)
|
||||
print json.decode(usf.folders)
|
||||
self.assertEquals(json.decode(usf.folders), [{u'Tech': [4, 5, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]}, 1, 2, 3, 6, {u'New York': [1, 2, 3, 4, 5, 6, 7, 8, 9]}, {u'tech': []}, {u'Blogs': [29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, {u'The Bloglets': [45, 46, 47, 48, 49]}]}, {u'Cooking': [50, 51, 52, 53]}, 54])
|
||||
|
||||
def test_opml_import__empty(self):
|
||||
self.client.login(username='conesus', password='test')
|
||||
user = User.objects.get(username='conesus')
|
||||
|
@ -58,6 +62,6 @@ class ImportTest(TestCase):
|
|||
self.assertEquals(subs.count(), 66)
|
||||
|
||||
usf = UserSubscriptionFolders.objects.get(user=user)
|
||||
print json.decode(usf.folders)
|
||||
# print json.decode(usf.folders)
|
||||
self.assertEquals(json.decode(usf.folders), [{u'Tech': [4, 5, 2, 9, 10, 12, 13, 14, 20, 23, 24, 26, 27, 28, 31, 32, 33, 34, 48, 49, 62, 64]}, 1, 2, 3, 6, {u'Blogs': [1, 3, 25, 29, 30, 39, 40, 41, 50, 55, 57, 58, 59, 60, 66]}, {u'Blogs \u2014 Tumblrs': [5, 21, 37, 38, 53, 54, 63, 65]}, {u'Blogs \u2014 The Bloglets': [6, 16, 22, 35, 51, 56]}, {u'New York': [7, 8, 17, 18, 19, 36, 45, 47, 52, 61]}, {u'Cooking': [11, 15, 42, 43, 46]}, 44])
|
||||
|
|
@ -184,7 +184,7 @@ def add_object_to_folder(obj, in_folder, folders, parent='', added=False):
|
|||
for item in folders:
|
||||
if isinstance(item, dict):
|
||||
child_folder_names.append(item.keys()[0])
|
||||
if isinstance(obj, dict) and in_folder == parent:
|
||||
if isinstance(obj, dict) and in_folder.lower() == parent.lower():
|
||||
if obj_identifier not in child_folder_names:
|
||||
folders.append(obj)
|
||||
return folders
|
||||
|
@ -192,7 +192,7 @@ def add_object_to_folder(obj, in_folder, folders, parent='', added=False):
|
|||
for k, v in enumerate(folders):
|
||||
if isinstance(v, dict):
|
||||
for f_k, f_v in v.items():
|
||||
if f_k == in_folder and obj_identifier not in f_v and not added:
|
||||
if f_k.lower() == in_folder.lower() and obj_identifier not in f_v and not added:
|
||||
f_v.append(obj)
|
||||
added = True
|
||||
folders[k][f_k] = add_object_to_folder(obj, in_folder, f_v, f_k, added)
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
import sys
|
||||
from settings import *
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'NAME': 'memory',
|
||||
'TEST_NAME': ':memory:',
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'USER': 'newsblur',
|
||||
'PASSWORD': '',
|
||||
'HOST': '127.0.0.1',
|
||||
}
|
||||
}
|
||||
|
||||
# if 'test' in sys.argv:
|
||||
# DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
||||
# DATABASES['default']['OPTIONS'] = {}
|
||||
# # DATABASES['default']['NAME'] = 'nb.db'
|
||||
# # DATABASES['default']['TEST_NAME'] = 'nb2.db'
|
||||
|
||||
# DATABASES = {
|
||||
# 'default':{
|
||||
# 'ENGINE': 'django.db.backends.sqlite3',
|
||||
|
@ -23,7 +20,7 @@ MONGO_DB = {
|
|||
}
|
||||
|
||||
MONGO_DATABASE_NAME = 'test_newsblur'
|
||||
TEST_DATABASE_NAME = ":memory:"
|
||||
# TEST_DATABASE_NAME = ":memory:"
|
||||
SOUTH_TESTS_MIGRATE = False
|
||||
DAYS_OF_UNREAD = 9999
|
||||
TEST_DEBUG = True
|
||||
|
|
|
@ -12,13 +12,14 @@ class TestRunner(DjangoTestSuiteRunner):
|
|||
return super(TestRunner, self).setup_databases(**kwargs)
|
||||
|
||||
def teardown_databases(self, db_name, **kwargs):
|
||||
from pymongo import Connection
|
||||
conn = Connection()
|
||||
import pymongo
|
||||
conn = pymongo.MongoClient()
|
||||
db_name = 'newsblur_test'
|
||||
conn.drop_database(db_name)
|
||||
print 'Dropping test-database: ' + db_name
|
||||
return super(TestRunner, self).teardown_databases(db_name, **kwargs)
|
||||
|
||||
|
||||
class TestCase(TransactionTestCase):
|
||||
def _fixture_setup(self):
|
||||
pass
|
||||
# class TestCase(TransactionTestCase):
|
||||
# def _fixture_setup(self):
|
||||
# pass
|
||||
|
|
Loading…
Add table
Reference in a new issue