mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00

* django1.11: (73 commits)
Switching to new celery 4 standalone binary.
Fixing various mongo data calls.
Upgrading to latest celery 4 (holy moly), which required some big changes to project layout. Still needs supervisor scripts updated.
Removing unused log on cookies.
I believe this Context wrapping is still preserved. See this django ticket: https://code.djangoproject.com/ticket/28125. Reverting this fixes the error, so I'm assuming this is that type of render.
Have to revert 3f122d5e03
because this broke existing sessions (logged me out) because the model has changed and the serialized model stored in redis no longer matches. Whew, this took a while to figure out.
Upgrading redis cache.
Adding cookies to path inspector.
Removing dupe db log.
Fixing missing DB logs (redis and mongo) due to this change in django 1.8: "connections.queries is now a read-only attribute."
Removing migrations that set a default date of 2020-05-08. Not sure why this was committed. I thought we resolved the issue with default datetimes?
Fixing CallableBool.
Missing import
Fixing runtime errors on django 1.10
Fixing OAuth connect.
Fixing various django1.9 issues, mainly around templates.
BASE_DIR
Not every story is from a feed.
Styling background colors for newsletters.
Styling more newsletter elements.
...
49 lines
2.1 KiB
Python
49 lines
2.1 KiB
Python
import os
|
|
from django.test.client import Client
|
|
from django.test import TestCase
|
|
from django.contrib.auth.models import User
|
|
from django.urls import reverse
|
|
from apps.reader.models import UserSubscription, UserSubscriptionFolders
|
|
from utils import json_functions as json
|
|
|
|
class ImportTest(TestCase):
|
|
fixtures = ['opml_import.json']
|
|
|
|
def setUp(self):
|
|
self.client = Client()
|
|
|
|
def test_opml_import(self):
|
|
self.client.login(username='conesus', password='test')
|
|
user = User.objects.get(username='conesus')
|
|
|
|
# Verify user has no feeds
|
|
subs = UserSubscription.objects.filter(user=user)
|
|
self.assertEqual(subs.count(), 0)
|
|
|
|
f = open(os.path.join(os.path.dirname(__file__), 'fixtures/opml.xml'))
|
|
response = self.client.post(reverse('opml-upload'), {'file': f})
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
# Verify user now has feeds
|
|
subs = UserSubscription.objects.filter(user=user)
|
|
self.assertEqual(subs.count(), 54)
|
|
|
|
usf = UserSubscriptionFolders.objects.get(user=user)
|
|
print(json.decode(usf.folders))
|
|
self.assertEqual(json.decode(usf.folders), [{'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, {'New York': [1, 2, 3, 4, 5, 6, 7, 8, 9]}, {'tech': []}, {'Blogs': [29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, {'The Bloglets': [45, 46, 47, 48, 49]}]}, {'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')
|
|
|
|
# Verify user has default feeds
|
|
subs = UserSubscription.objects.filter(user=user)
|
|
self.assertEqual(subs.count(), 0)
|
|
|
|
response = self.client.post(reverse('opml-upload'))
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
# Verify user now has feeds
|
|
subs = UserSubscription.objects.filter(user=user)
|
|
|
|
self.assertEquals(subs.count(), 0)
|