Skip to content

Commit

Permalink
Merge pull request #9 from mdhaman/skeds
Browse files Browse the repository at this point in the history
Fixing the skeds test and updating cores
  • Loading branch information
Mayur Dhamanwala authored Jun 15, 2016
2 parents f0e7b16 + 1e3ba7f commit a811818
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 20 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "superdesk",
"license": "GPL-3.0",
"dependencies": {
"superdesk-core": "superdesk/superdesk-client-core#d4d400cc8",
"superdesk-core": "superdesk/superdesk-client-core#875642150",
"grunt": "~0.4.5",
"grunt-angular-gettext": "2.1.3",
"grunt-angular-templates": "0.5.7",
Expand Down
63 changes: 48 additions & 15 deletions server/aap/macros/generate_slugline_story_by_desk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

from superdesk.tests import TestCase
from test_factory import SuperdeskTestCase
from superdesk.utc import utc_to_local, utcnow
from datetime import timedelta
from .generate_slugline_story_by_desk import GenerateBodyHtmlForPublishedArticlesByDesk, \
generate_published_slugline_story_by_desk


class SluglineStoryByDesk(TestCase):
class SluglineStoryByDesk(SuperdeskTestCase):
articles = []
published = []
desks = []
Expand All @@ -36,7 +36,10 @@ def setUp(self):
{
'_id': '1', 'type': 'text', 'abstract': 'abstract item 1', 'slugline': 'slugline item 1',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'in_progress',
'versioncreated': local_time + timedelta(minutes=-1),
Expand All @@ -47,7 +50,10 @@ def setUp(self):
{
'_id': '2', 'type': 'text', 'abstract': 'abstract item 2', 'slugline': 'slugline item 2',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'submitted',
'versioncreated': local_time + timedelta(minutes=-2),
Expand All @@ -59,7 +65,10 @@ def setUp(self):
{
'_id': '2a', 'type': 'text', 'abstract': 'abstract item 2a', 'slugline': 'slugline item 2a',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'published',
'versioncreated': local_time + timedelta(minutes=-5),
Expand All @@ -71,7 +80,10 @@ def setUp(self):
{
'_id': '3', 'type': 'text', 'abstract': 'abstract item 3', 'slugline': 'slugline item 3',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'submitted',
'versioncreated': local_time + timedelta(days=-1),
Expand All @@ -83,7 +95,10 @@ def setUp(self):
{
'_id': '4', 'type': 'text', 'abstract': 'abstract item 4', 'slugline': 'slugline item 4',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'corrected',
'versioncreated': local_time + timedelta(minutes=-1),
Expand All @@ -94,7 +109,10 @@ def setUp(self):
{
'_id': '5', 'type': 'text', 'abstract': 'abstract item 5', 'slugline': 'slugline item 5',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'in_progress',
'versioncreated': local_time + timedelta(minutes=-1),
Expand All @@ -106,7 +124,10 @@ def setUp(self):
{
'_id': '6', 'type': 'text', 'abstract': 'abstract item 6', 'slugline': 'slugline item 6',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'published',
'versioncreated': local_time + timedelta(days=-1),
Expand All @@ -120,7 +141,10 @@ def setUp(self):
{
'item_id': '2a', 'type': 'text', 'abstract': 'abstract item 2a', 'slugline': 'slugline item 2a',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'published',
'versioncreated': local_time + timedelta(minutes=-5),
Expand All @@ -132,7 +156,10 @@ def setUp(self):
{
'item_id': '4', 'type': 'text', 'abstract': 'abstract item 4', 'slugline': 'slugline item 4',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'corrected',
'versioncreated': local_time + timedelta(minutes=-1),
Expand All @@ -143,7 +170,10 @@ def setUp(self):
{
'item_id': '4', 'type': 'text', 'abstract': 'abstract item 4', 'slugline': 'slugline item 4',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'published',
'versioncreated': local_time + timedelta(minutes=-5),
Expand All @@ -154,7 +184,10 @@ def setUp(self):
{
'item_id': '6', 'type': 'text', 'abstract': 'abstract item 6', 'slugline': 'slugline item 6',
'dateline': {
'text': 'Sydney, 01 Jan AAP -'
'text': 'Sydney, 01 Jan AAP -',
'located': {
'city': 'Sydney'
}
},
'state': 'published',
'versioncreated': local_time + timedelta(days=-1),
Expand Down Expand Up @@ -191,5 +224,5 @@ def test_generate_body_html(self):
}

generate_published_slugline_story_by_desk(item)
self.assertTrue('Sydney, 01 Jan AAP - abstract item 2 (slugline item 2)' in item['body_html'])
self.assertTrue('Sydney, 01 Jan AAP - abstract item 2a (slugline item 2a)' in item['body_html'])
self.assertTrue('SYDNEY abstract item 2 (slugline item 2)' in item['body_html'])
self.assertTrue('SYDNEY abstract item 2a (slugline item 2a)' in item['body_html'])
2 changes: 1 addition & 1 deletion server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ gunicorn==19.4.5
honcho==0.6.6
pyodbc==3.0.10

git+git://github.com/superdesk/superdesk-core.git@b642511a7#egg=Superdesk-Core
git+git://github.com/superdesk/superdesk-core.git@a22ba133a#egg=Superdesk-Core
1 change: 1 addition & 0 deletions server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def env(variable, fallback_value=None):
'apps.publish.enqueue',
'apps.publish.formatters',
'apps.content_filters',
'apps.content_types',
'apps.dictionaries',
'apps.duplication',
'apps.spellcheck',
Expand Down
2 changes: 1 addition & 1 deletion server/templates/skeds_body_html.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% for item in items %}
<p>{{item.dateline_city}} - {{item.abstract|striptags}} ({{item.slugline}}) {{item.anpa_take_key}} {{item.versioncreated | format_datetime('Australia/Sydney', '%H:%S')}}</p></br>
<p>{{item.dateline_city}} {{item.abstract|striptags}} ({{item.slugline}}) {{item.anpa_take_key}} {{item.versioncreated | format_datetime('Australia/Sydney', '%H:%S')}}</p></br>
{% endfor %}
8 changes: 6 additions & 2 deletions server/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from superdesk.tests import TestCase, setup, setup_db_user, test_user, get_prefixed_url, add_to_context
from app import get_app
from unittest.mock import patch
from settings import LDAP_SERVER
from settings import LDAP_SERVER, CUSTOM_TEMPLATE_PATH
from apps.ldap import ADAuth


Expand Down Expand Up @@ -73,7 +73,11 @@ def setup_ad_user(context, user):
class SuperdeskTestCase(TestCase):

def setUp(self):
setup(self, app_factory=get_app)
config = {
'ELASTICSEARCH_FORCE_REFRESH': True,
'CUSTOM_TEMPLATE_PATH': CUSTOM_TEMPLATE_PATH
}
setup(self, config=config, app_factory=get_app)
self.ctx = self.app.app_context()
self.ctx.push()

Expand Down

0 comments on commit a811818

Please sign in to comment.