Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from mkouhei/devel
release 0.3.3
- Loading branch information
Showing
10 changed files
with
120 additions
and
8 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
include MANIFEST.in | ||
include README.rst | ||
include LICENSE | ||
recursive-include docs *.rst | ||
recursive-include shiori *.py *.html *.js *.css *.png |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Shiori new bookmarks</title><link>http://localhost:8000/shiori/</link><description>Updates on changes and additions to Shiori.</description><atom:link href="http://localhost:8000/shiori/feeds" rel="self"></atom:link><language>en-us</language><lastBuildDate>Sun, 11 May 2014 01:07:25 -0000</lastBuildDate><item><title>How to build custom Debian package automatically by Jenkins</title><link>http://localhost:8000/shiori/b/h6xWZg6qMFKU4hyeySZppi</link><description><div> | ||
<h3>category: <span class="category">test</span></h3> | ||
<p></p> | ||
</div> | ||
</description><guid>http://localhost:8000/shiori/b/h6xWZg6qMFKU4hyeySZppi</guid></item><item><title>Retrieve and generate debian package of Oracle JDK</title><link>http://localhost:8000/shiori/b/mP3J7ECygP4Va3MLFgYgfP</link><description><div> | ||
<h3>category: <span class="category">test</span></h3> | ||
<p></p> | ||
</div> | ||
</description><guid>http://localhost:8000/shiori/b/mP3J7ECygP4Va3MLFgYgfP</guid></item><item><title>Manage multiple distributions with reprepro</title><link>http://localhost:8000/shiori/b/2jhgpAkPNU9M8uZZ8uq6gV</link><description><div> | ||
<h3>category: <span class="category">test</span></h3> | ||
<p></p> | ||
</div> | ||
</description><guid>http://localhost:8000/shiori/b/2jhgpAkPNU9M8uZZ8uq6gV</guid></item><item><title>Infinite loop using chord of Celery</title><link>http://localhost:8000/shiori/b/FQ47A8MSpMg3gwqKt9cEC6</link><description><div> | ||
<h3>category: <span class="category">test</span></h3> | ||
<p></p> | ||
</div> | ||
</description><guid>http://localhost:8000/shiori/b/FQ47A8MSpMg3gwqKt9cEC6</guid></item><item><title>OBS266はやっぱり綺麗だなぁ。</title><link>http://localhost:8000/shiori/b/zyvKxw3eQseShLjmd7Rrwe</link><description><div> | ||
<h3>category: <span class="category">computer</span></h3> | ||
<p>テストhogeだす。</p> | ||
</div> | ||
</description><guid>http://localhost:8000/shiori/b/zyvKxw3eQseShLjmd7Rrwe</guid></item></channel></rss> |
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 @@ | ||
# -*- coding: utf-8 -*- | ||
import unittest | ||
from httpretty import HTTPretty, httprettified | ||
from defusedxml.lxml import RestrictedElement | ||
from shiori.bookmark.agents import feed_parser | ||
|
||
|
||
class FeedParserTests(unittest.TestCase): | ||
|
||
def test_retrieve_not_connect_server(self): | ||
with self.assertRaises(SystemExit) as e: | ||
parser = feed_parser.FeedParser('http://example.org/rss') | ||
self.assertEqual(1, e.exception.code) | ||
|
||
@httprettified | ||
def test_feedparser_not_expected_response(self): | ||
HTTPretty.register_uri(HTTPretty.GET, | ||
'http://example.org/rss') | ||
with self.assertRaises(SystemExit) as e: | ||
parser = feed_parser.FeedParser('http://example.org/rss') | ||
self.assertEqual(1, e.exception.code) | ||
|
||
@httprettified | ||
def test_feedparser_properties(self): | ||
with open('shiori_tests/test_data/dummy_rss.xml', 'rb') as f: | ||
content = f.read() | ||
HTTPretty.register_uri(HTTPretty.GET, | ||
'http://example.org/rss', | ||
body=content) | ||
parser = feed_parser.FeedParser('http://example.org/rss') | ||
self.assertEqual({'atom': 'http://www.w3.org/2005/Atom'}, | ||
parser.nsmap) | ||
self.assertEqual('', parser.ns) | ||
self.assertEqual('Sun, 11 May 2014 01:07:25 -0000', | ||
parser.updated) | ||
self.assertEqual('Shiori new bookmarks', parser.title) | ||
self.assertEqual(5, len(parser.items)) | ||
self.assertTrue(isinstance(parser.etree, RestrictedElement)) | ||
|
||
@httprettified | ||
def test_retrieve_items(self): | ||
with open('shiori_tests/test_data/dummy_rss.xml', 'rb') as f: | ||
content = f.read() | ||
HTTPretty.register_uri(HTTPretty.GET, | ||
'http://example.org/rss', | ||
body=content) | ||
parser = feed_parser.FeedParser('http://example.org/rss') | ||
items = parser.retrieve_items() | ||
self.assertEqual(5, len(items)) |
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,29 @@ | ||
# -*- coding: utf-8 -*- | ||
import unittest | ||
from django.core.exceptions import ValidationError | ||
from shiori.bookmark import validators | ||
|
||
|
||
class ValidatorsTests(unittest.TestCase): | ||
def test_validate_url(self): | ||
self.assertTrue(validators.validate_url('http://example.org')) | ||
|
||
def test_validate_url_of_localhost(self): | ||
self.assertRaises(ValidationError, | ||
validators.validate_url, | ||
'http://localhost') | ||
|
||
def test_validate_url_of_not_found(self): | ||
self.assertRaises(ValidationError, | ||
validators.validate_url, | ||
'http://hoge.example.org') | ||
|
||
def test_validate_url_of_loopback_addr(self): | ||
self.assertRaises(ValidationError, | ||
validators.validate_url, | ||
'http://127.0.0.1') | ||
|
||
def test_get_addr(self): | ||
self.assertListEqual(['93.184.216.119', | ||
'2606:2800:220:6d:26bf:1447:1097:aa7'], | ||
validators.getaddr('example.org')) |
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