Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加测试 #31

Merged
merged 1 commit into from
Sep 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ omit =
*apps*
*commands*
*oauth*
*travis_test*
26 changes: 26 additions & 0 deletions blog/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from blog.models import Article, Category, Tag
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from blog.forms import BlogSearchForm
from django.core.paginator import Paginator
from blog.templatetags.blog_tags import load_pagination_info, load_articletags
import datetime
from accounts.models import BlogUser

Expand Down Expand Up @@ -54,6 +57,29 @@ def test_validate_article(self):
response = self.client.get(category.get_absolute_url())
self.assertEqual(response.status_code, 200)

response = self.client.get('/search', {'q': 'django'})
self.assertEqual(response.status_code, 200)
s = load_articletags(article)
self.assertIsNotNone(s)

p = Paginator(Article.objects.all(), 2)
s = load_pagination_info(p.page(1), '', '')
self.assertIsNotNone(s)

p = Paginator(Tag.objects.all(), 2)
s = load_pagination_info(p.page(1), '分类标签归档', 'tagname')
self.assertIsNotNone(s)

p = Paginator(BlogUser.objects.all(), 2)
s = load_pagination_info(p.page(1), '作者文章归档', 'username')
self.assertIsNotNone(s)

p = Paginator(Category.objects.all(), 2)
s = load_pagination_info(p.page(1), '分类目录归档', 'categoryname')
self.assertIsNotNone(s)

f = BlogSearchForm()
f.search()
from DjangoBlog.spider_notify import SpiderNotify
SpiderNotify.baidu_notify([article.get_full_url()])

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
appdirs==1.4.3
Django==1.11.4
Django==1.11.5
django-appconf==1.0.2
django-autoslug==1.9.3
django-compressor==2.2
Expand Down
1 change: 0 additions & 1 deletion servermanager/Api/commonapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ def getdata(self, content):
if str(jsons["code"]) == '100000':
return jsons["text"]
except Exception as e:
print(e)
logger.warn(e)
return "哎呀,出错啦。"
2 changes: 1 addition & 1 deletion servermanager/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class CommandsAdmin(admin.ModelAdmin):
pass
list_display = ('title', 'command', 'describe')


admin.site.register(commands, CommandsAdmin)
2 changes: 1 addition & 1 deletion travis_test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
appdirs==1.4.3
Django==1.11.4
Django==1.11.5
django-appconf==1.0.2
django-autoslug==1.9.3
django-compressor==2.2
Expand Down