Tests can now be run from any server/environment.

This commit is contained in:
Samuel Clay 2009-08-09 19:22:09 +00:00
parent 9626b4695a
commit 0582b052bf
5 changed files with 9 additions and 3 deletions

View file

@ -3,7 +3,7 @@
"pk": 1,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "/Users/conesus/newsblur/apps/rss_feeds/fixtures/gawker1.xml",
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/gawker1.xml",
"days_to_trim": 90,
"feed_link": "http://gawker.com",
"num_subscribers": 0,

View file

@ -3,7 +3,7 @@
"pk": 1,
"model": "rss_feeds.feed",
"fields": {
"feed_address": "/Users/conesus/newsblur/apps/rss_feeds/fixtures/gawker2.xml",
"feed_address": "%(NEWSBLUR_DIR)s/apps/rss_feeds/fixtures/gawker2.xml",
"days_to_trim": 90,
"feed_link": "http://gawker.com",
"num_subscribers": 0,

View file

@ -12,6 +12,7 @@ from utils.story_functions import format_story_link_date__short
from utils.story_functions import format_story_link_date__long
from django.db.models import Q
from utils.diff import HTMLDiff
import settings
import logging
USER_AGENT = 'NewsBlur v1.0 - newsblur.com'
@ -46,6 +47,7 @@ class Feed(models.Model):
print locals()
def update(self, force=False, feed=None):
self.feed_address = self.feed_address % {'NEWSBLUR_DIR': settings.NEWSBLUR_DIR}
last_updated = self.last_updated() / 60
min_to_decay = self.min_to_decay + (random.random()*self.min_to_decay)
if last_updated < min_to_decay and not force:

View file

@ -9,7 +9,7 @@ class FeedTest(TestCase):
def setUp(self):
self.client = Client()
def test_load_feeds(self):
def test_load_feeds__changed_story_title(self):
self.client.login(userame='conesus', password='test')
management.call_command('loaddata', 'gawker1.json', verbosity=0)

View file

@ -26,6 +26,7 @@ if PRODUCTION:
DATABASE_PORT = ''
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
NEWSBLUR_DIR = '/home/conesus/newsblur/'
MEDIA_ROOT = '/home/conesus/newsblur/media/'
MEDIA_URL = 'http://www.newsblur.com/media/'
TEMPLATE_DIRS = (
@ -47,6 +48,7 @@ elif STAGING:
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
NEWSBLUR_DIR = '/home/conesus/stg-newsblur/'
MEDIA_ROOT = '/home/conesus/stg-newsblur/media/'
MEDIA_URL = '/media/'
TEMPLATE_DIRS = (
@ -68,6 +70,7 @@ elif DEV_SERVER1:
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
NEWSBLUR_DIR = '/Users/conesus/Projects/newsblur/'
MEDIA_ROOT = '/Users/conesus/Projects/newsblur/media/'
MEDIA_URL = '/media/'
TEMPLATE_DIRS = (
@ -89,6 +92,7 @@ elif DEV_SERVER2:
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
NEWSBLUR_DIR = '/Users/conesus/newsblur/'
MEDIA_ROOT = '/Users/conesus/newsblur/media/'
MEDIA_URL = '/media/'
TEMPLATE_DIRS = (