Skip to content

Commit

Permalink
Add some trivial interfaces tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Oct 9, 2017
1 parent 2d230e7 commit 906f4c1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
0.0.1a1 (unreleased)
====================

- Nothing yet.
- Preliminary PyPI release. While this package is functional, it is
not yet documented sufficiently to be of general use. It is also not
expected to be fully stable.
2 changes: 1 addition & 1 deletion src/nti/nikola_chameleon/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class IPostPage(IPost, IPageKind):
def _build(iface, result):
kinds = iface.getTaggedValue('__pagekinds__')
kinds = frozenset(kinds)
if kinds in result and kinds:
if kinds in result and kinds: # pragma: no cover
raise ValueError("Duplicate pagkeinds", kinds, iface)

if kinds not in result:
Expand Down
38 changes: 38 additions & 0 deletions src/nti/nikola_chameleon/tests/test_interfaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
"""
Tests for interfaces.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# stdlib imports
import unittest

from nti.testing.matchers import implements

from hamcrest import assert_that
from hamcrest import has_entry

# disable: accessing protected members, too many methods
# pylint: disable=W0212,R0904



class TestInterfaces(unittest.TestCase):

@property
def _FUT(self):
from nti.nikola_chameleon import interfaces
return interfaces

def test_post_implements(self):
from nikola.post import Post
assert_that(Post, implements(self._FUT.IPost))

def test_story_page_kind(self):
interfaces = self._FUT
assert_that(interfaces.PAGEKINDS,
has_entry(frozenset(('page_page', 'story_page')),
interfaces.IStoryPageKind))

0 comments on commit 906f4c1

Please sign in to comment.