Skip to content

Commit

Permalink
Add test for warning
Browse files Browse the repository at this point in the history
  • Loading branch information
circlingthesun committed Apr 30, 2015
1 parent 0045b74 commit ef4fd62
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cornice/tests/test_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,24 @@ def put(self):
return dict(type=repr(self.context))


class TestResourceWarning(TestCase):
@mock.patch('warnings.warn')
def test_path_clash(self, mocked_warn):
@resource(collection_path='/badthing/{id}', path='/badthing/{id}',
name='bad_thing_service')
class BadThing(object):
def __init__(self, request, context=None):
pass

msg = "Warning: collection_path and path are not distinct."
mocked_warn.assert_called_with(msg)


class TestResource(TestCase):

def setUp(self):
from pyramid.renderers import JSONP

self.config = testing.setUp()
self.config.add_renderer('jsonp', JSONP(param_name='callback'))
self.config.include("cornice")
Expand Down

0 comments on commit ef4fd62

Please sign in to comment.