forked from liangliangyy/DjangoBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3742457
commit d67206c
Showing
11 changed files
with
411 additions
and
53 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,36 @@ | ||
language: python | ||
python: | ||
- "3.5" | ||
- "3.6" | ||
services: | ||
- mysql | ||
env: | ||
global: | ||
- DJANGO_SETTINGS_MODULE="test.travis_settings" | ||
matrix: | ||
- DJANGO="Django==1.8" | ||
- DJANGO="Django==1.9" | ||
- DJANGO="Django==1.10" | ||
branches: | ||
only: | ||
- master | ||
# command to install dependencies | ||
install: | ||
- pip install -r test/requirements.txt | ||
- pip install "$DJANGO" | ||
- pip install python-coveralls | ||
- pip install coverage | ||
before_script: | ||
- mysql -e 'CREATE DATABASE `djangoblog` /*!40100 DEFAULT CHARACTER SET utf8 */;' | ||
- python manage.py makemigrations accounts | ||
- python manage.py makemigrations blog | ||
- python manage.py makemigrations comments | ||
- python manage.py makemigrations oauth | ||
- python manage.py migrate | ||
- python manage.py collectstatic --noinput | ||
- python manage.py compress --force | ||
# command to run tests | ||
script: | ||
- coverage run manage.py test | ||
after_success: | ||
- coveralls |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,44 @@ | ||
from django.test import TestCase | ||
from django.test import Client, RequestFactory, TestCase | ||
from blog.models import Article, Category, Tag | ||
from django.contrib.auth import get_user_model | ||
from django.contrib.sites.models import Site | ||
import datetime | ||
|
||
|
||
# Create your tests here. | ||
|
||
class ArticleTest(TestCase): | ||
def setUp(self): | ||
self.client = Client() | ||
self.factory = RequestFactory() | ||
|
||
def test_validate_article(self): | ||
from accounts.models import BlogUser | ||
site = Site.objects.get_current().domain | ||
user = BlogUser() | ||
user.email = "[email protected]" | ||
user.username = "liangliangyy" | ||
user.password = "liangliangyy" | ||
user.save() | ||
response = self.client.get(user.get_absolute_url()) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
category = Category() | ||
category.name = "category" | ||
category.created_time = datetime.datetime.now() | ||
category.last_mod_time = datetime.datetime.now() | ||
category.save() | ||
|
||
response = self.client.get(category.get_absolute_url()) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
article = Article() | ||
article.title = "nicetitle" | ||
article.body = "nicecontent" | ||
article.author = user | ||
article.category = category | ||
article.type = 'a' | ||
article.status = 'p' | ||
article.save() | ||
response = self.client.get(article.get_absolute_url()) | ||
self.assertEqual(response.status_code, 200) |
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 |
---|---|---|
@@ -1,44 +1,3 @@ | ||
from django.test import Client, RequestFactory, TestCase | ||
from blog.models import Article, Category, Tag | ||
from django.contrib.auth import get_user_model | ||
from django.contrib.sites.models import Site | ||
import datetime | ||
from django.test import TestCase | ||
|
||
|
||
# Create your tests here. | ||
|
||
class ArticleTest(TestCase): | ||
def setUp(self): | ||
self.client = Client() | ||
self.factory = RequestFactory() | ||
|
||
def test_validate_article(self): | ||
from accounts.models import BlogUser | ||
site = Site.objects.get_current().domain | ||
user = BlogUser() | ||
user.email = "[email protected]" | ||
user.username = "liangliangyy" | ||
user.password = "liangliangyy" | ||
user.save() | ||
response = self.client.get(user.get_absolute_url()) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
category = Category() | ||
category.name = "category" | ||
category.created_time = datetime.datetime.now() | ||
category.last_mod_time = datetime.datetime.now() | ||
category.save() | ||
|
||
response = self.client.get(category.get_absolute_url()) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
article = Article() | ||
article.title = "nicetitle" | ||
article.body = "nicecontent" | ||
article.author = user | ||
article.category = category | ||
article.type = 'a' | ||
article.status = 'p' | ||
article.save() | ||
response = self.client.get(article.get_absolute_url()) | ||
self.assertEqual(response.status_code, 200) | ||
# Create your tests here. |
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,2 @@ | ||
import pymysql | ||
pymysql.install_as_MySQLdb() |
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,17 @@ | ||
Django | ||
django-autoslug | ||
django-haystack | ||
django-pagedown | ||
django-uuslug | ||
jieba | ||
markdown2 | ||
Pillow | ||
PyMySQL | ||
python-slugify | ||
requests | ||
Unidecode | ||
Whoosh | ||
mistune | ||
pygments | ||
django-ipware | ||
django_compressor |
Oops, something went wrong.