mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Tests can now be run from any server/environment.
This commit is contained in:
parent
9626b4695a
commit
0582b052bf
5 changed files with 9 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
||||||
"pk": 1,
|
"pk": 1,
|
||||||
"model": "rss_feeds.feed",
|
"model": "rss_feeds.feed",
|
||||||
"fields": {
|
"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,
|
"days_to_trim": 90,
|
||||||
"feed_link": "http://gawker.com",
|
"feed_link": "http://gawker.com",
|
||||||
"num_subscribers": 0,
|
"num_subscribers": 0,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"pk": 1,
|
"pk": 1,
|
||||||
"model": "rss_feeds.feed",
|
"model": "rss_feeds.feed",
|
||||||
"fields": {
|
"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,
|
"days_to_trim": 90,
|
||||||
"feed_link": "http://gawker.com",
|
"feed_link": "http://gawker.com",
|
||||||
"num_subscribers": 0,
|
"num_subscribers": 0,
|
||||||
|
|
|
@ -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 utils.story_functions import format_story_link_date__long
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from utils.diff import HTMLDiff
|
from utils.diff import HTMLDiff
|
||||||
|
import settings
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
USER_AGENT = 'NewsBlur v1.0 - newsblur.com'
|
USER_AGENT = 'NewsBlur v1.0 - newsblur.com'
|
||||||
|
@ -46,6 +47,7 @@ class Feed(models.Model):
|
||||||
print locals()
|
print locals()
|
||||||
|
|
||||||
def update(self, force=False, feed=None):
|
def update(self, force=False, feed=None):
|
||||||
|
self.feed_address = self.feed_address % {'NEWSBLUR_DIR': settings.NEWSBLUR_DIR}
|
||||||
last_updated = self.last_updated() / 60
|
last_updated = self.last_updated() / 60
|
||||||
min_to_decay = self.min_to_decay + (random.random()*self.min_to_decay)
|
min_to_decay = self.min_to_decay + (random.random()*self.min_to_decay)
|
||||||
if last_updated < min_to_decay and not force:
|
if last_updated < min_to_decay and not force:
|
||||||
|
|
|
@ -9,7 +9,7 @@ class FeedTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client = Client()
|
self.client = Client()
|
||||||
|
|
||||||
def test_load_feeds(self):
|
def test_load_feeds__changed_story_title(self):
|
||||||
self.client.login(userame='conesus', password='test')
|
self.client.login(userame='conesus', password='test')
|
||||||
|
|
||||||
management.call_command('loaddata', 'gawker1.json', verbosity=0)
|
management.call_command('loaddata', 'gawker1.json', verbosity=0)
|
||||||
|
|
|
@ -26,6 +26,7 @@ if PRODUCTION:
|
||||||
DATABASE_PORT = ''
|
DATABASE_PORT = ''
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/Users/media/media.lawrence.com/"
|
# Example: "/Users/media/media.lawrence.com/"
|
||||||
|
NEWSBLUR_DIR = '/home/conesus/newsblur/'
|
||||||
MEDIA_ROOT = '/home/conesus/newsblur/media/'
|
MEDIA_ROOT = '/home/conesus/newsblur/media/'
|
||||||
MEDIA_URL = 'http://www.newsblur.com/media/'
|
MEDIA_URL = 'http://www.newsblur.com/media/'
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
|
@ -47,6 +48,7 @@ elif STAGING:
|
||||||
|
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/Users/media/media.lawrence.com/"
|
# Example: "/Users/media/media.lawrence.com/"
|
||||||
|
NEWSBLUR_DIR = '/home/conesus/stg-newsblur/'
|
||||||
MEDIA_ROOT = '/home/conesus/stg-newsblur/media/'
|
MEDIA_ROOT = '/home/conesus/stg-newsblur/media/'
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
|
@ -68,6 +70,7 @@ elif DEV_SERVER1:
|
||||||
|
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/Users/media/media.lawrence.com/"
|
# Example: "/Users/media/media.lawrence.com/"
|
||||||
|
NEWSBLUR_DIR = '/Users/conesus/Projects/newsblur/'
|
||||||
MEDIA_ROOT = '/Users/conesus/Projects/newsblur/media/'
|
MEDIA_ROOT = '/Users/conesus/Projects/newsblur/media/'
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
|
@ -89,6 +92,7 @@ elif DEV_SERVER2:
|
||||||
|
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/Users/media/media.lawrence.com/"
|
# Example: "/Users/media/media.lawrence.com/"
|
||||||
|
NEWSBLUR_DIR = '/Users/conesus/newsblur/'
|
||||||
MEDIA_ROOT = '/Users/conesus/newsblur/media/'
|
MEDIA_ROOT = '/Users/conesus/newsblur/media/'
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
|
|
Loading…
Add table
Reference in a new issue