This repository has been archived by the owner on Mar 5, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into develop
- Loading branch information
Showing
14 changed files
with
226 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: python | ||
python: | ||
# - "3.3" | ||
# - "2.7" | ||
- "2.6" | ||
# install Arkestra & dependencies | ||
install: | ||
- pip install -r REQUIREMENTS.txt | ||
# command to run tests, e.g. python setup.py test | ||
script: python example/testrunner.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from datetime import datetime, timedelta | ||
|
||
from django.test import TestCase | ||
from django.test.client import Client | ||
|
||
from news_and_events.models import NewsArticle | ||
|
||
class NewsManagerTests(TestCase): | ||
def setUp(self): | ||
# Every test needs a client. | ||
self.client = Client() | ||
|
||
# create a news item | ||
self.tootharticle = NewsArticle( | ||
title = "All about teeth", | ||
slug = "all-about-teeth", | ||
) | ||
|
||
def test_published_items_no_saved_items(self): | ||
self.assertEqual( | ||
list(NewsArticle.objects.published_items()), | ||
[] | ||
) | ||
|
||
def test_published_items_one_saved_item_unpublished(self): | ||
self.tootharticle.date = datetime.now() - timedelta(minutes=30) | ||
self.tootharticle.save() | ||
self.assertEqual( | ||
list(NewsArticle.objects.published_items()), | ||
[] | ||
) | ||
|
||
def test_published_items_one_saved_published_but_future_item(self): | ||
self.tootharticle.published = True | ||
self.tootharticle.date = datetime.now() + timedelta(minutes=30) | ||
self.tootharticle.save() | ||
self.assertEqual( | ||
list(NewsArticle.objects.published_items()), | ||
[] | ||
) | ||
|
||
def test_published_items_one_saved_published_item(self): | ||
self.tootharticle.published = True | ||
self.tootharticle.date = datetime.now() - timedelta(minutes=30) | ||
self.tootharticle.save() | ||
self.assertEqual( | ||
list(NewsArticle.objects.published_items()), | ||
[self.tootharticle] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.