Permalink
Browse files

Fixing tests.

  • Loading branch information...
samuelclay committed Nov 28, 2012
1 parent a67ecf4 commit 1ad7031fbb86d4ee894d5cc176c6d3ef9a7fbf04
@@ -135,6 +135,14 @@
}
},
+ {
+ "pk": 2,
+ "model": "sites.site",
+ "fields": {
+ "domain": "testserver",
+ "name": "testserver"
+ }
+ },
{
"pk": 1,
View
@@ -351,7 +351,7 @@ def calculate_feed_scores(self, silent=False, stories=None):
# now = datetime.datetime.strptime("2009-07-06 22:30:03", "%Y-%m-%d %H:%M:%S")
now = datetime.datetime.now()
UNREAD_CUTOFF = now - datetime.timedelta(days=settings.DAYS_OF_UNREAD)
-
+
if self.user.profile.last_seen_on < UNREAD_CUTOFF:
# if not silent:
# logging.info(' ---> [%s] SKIPPING Computing scores: %s (1 week+)' % (self.user, self.feed))
View
@@ -2,13 +2,21 @@
from django.test.client import Client
from django.test import TestCase
from django.core.urlresolvers import reverse
+from django.conf import settings
+from mongoengine.connection import connect, disconnect
class ReaderTest(TestCase):
fixtures = ['subscriptions.json', 'stories.json', '../../rss_feeds/fixtures/gawker1.json']
+
def setUp(self):
+ disconnect()
+ settings.MONGODB = connect('test_newsblur')
self.client = Client()
-
+
+ def tearDown(self):
+ settings.MONGODB.drop_database('test_newsblur')
+
def test_api_feeds(self):
self.client.login(username='conesus', password='test')
@@ -1,16 +1,16 @@
[
{
- "pk": 1,
+ "pk": 2,
"model": "sites.site",
"fields": {
- "domain": "localhost",
- "name": "NewsBlur"
+ "domain": "testserver",
+ "name": "testserver"
}
},
{
"model": "auth.user",
"fields": {
- "username": "newsblur",
+ "username": "newsblur_test",
"first_name": "",
"last_name": "",
"is_active": true,
@@ -109,6 +109,14 @@
}
},
+ {
+ "pk": 2,
+ "model": "sites.site",
+ "fields": {
+ "domain": "testserver",
+ "name": "testserver"
+ }
+ },
{
View
@@ -3,15 +3,21 @@
from django.test import TestCase
from django.core import management
from django.core.urlresolvers import reverse
+from django.conf import settings
from apps.rss_feeds.models import Feed, MStory
-
+from mongoengine.connection import connect, disconnect
class FeedTest(TestCase):
fixtures = ['rss_feeds.json']
def setUp(self):
+ disconnect()
+ settings.MONGODB = connect('test_newsblur')
self.client = Client()
+ def tearDown(self):
+ settings.MONGODB.drop_database('test_newsblur')
+
def test_load_feeds__gawker(self):
self.client.login(username='conesus', password='test')
View
@@ -413,7 +413,8 @@ def process_feed_wrapper(self, feed_queue):
feed_code = 500
fetched_feed = None
mail_feed_error_to_admin(feed, e, local_vars=locals())
- if not settings.DEBUG:
+ if (not settings.DEBUG and hasattr(settings, 'RAVEN_CLIENT') and
+ settings.RAVEN_CLIENT):
settings.RAVEN_CLIENT.captureException(e)
if not feed_code:
View
@@ -1,24 +1,25 @@
from settings import *
DATABASES = {
'default': {
- 'NAME': ':memory:',
+ 'NAME': 'memory',
'ENGINE': 'django.db.backends.sqlite3',
'USER': 'newsblur',
'PASSWORD': '',
'HOST': '127.0.0.1',
}
}
MONGO_DB = {
- 'NAME': 'newsblur_test',
- 'HOST': '127.0.0.1',
- 'PORT': 27017
-}
+ 'name': 'newsblur_test',
+ 'host': '127.0.0.1:27017',
+}
+MONGO_DATABASE_NAME = 'test_newsblur'
TEST_DATABASE_NAME = ":memory:"
DAYS_OF_UNREAD = 9999
TEST_DEBUG = True
DEBUG = True
-
+SITE_ID = 2
+RAVEN_CLIENT = None
# from django.db import connection
# cursor = connection.cursor()
# cursor.execute('PRAGMA temp_store = MEMORY;')

0 comments on commit 1ad7031

Please sign in to comment.