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

Tests fail with WebOb 1.6 #266

Closed
Themanwithoutaplan opened this issue Mar 17, 2016 · 2 comments
Closed

Tests fail with WebOb 1.6 #266

Themanwithoutaplan opened this issue Mar 17, 2016 · 2 comments

Comments

@Themanwithoutaplan
Copy link
Contributor

WebOb now checks whether control characters are on contained. This leads to seven test failures like this.

Workaround would be to pin Webob at < 1.6a (thanks Zart) but obviously the mocking code needs fixing.

self = <substanced.folder.tests.test_views.TestFolderContents testMethod=test_duplicate_multiple>
mock_rename_duplicated_resource = <MagicMock name='rename_duplicated_resource' id='4396383200'>

    @mock.patch('substanced.folder.views.rename_duplicated_resource')
    def test_duplicate_multiple(self, mock_rename_duplicated_resource):
        context = mock.Mock()
        request = mock.Mock()
        request.localizer = testing.DummyRequest().localizer
        request.view_name = 'contents'
        request.params = {}
        request.POST.get.return_value = 'a/b'
        mock_rename_duplicated_resource.side_effect = ['a-1', 'b-1']

        inst = self._makeOne(context, request)
>       inst.duplicate()

substanced/folder/tests/test_views.py:844:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
substanced/folder/views.py:784: in duplicate
    return self.get_redirect_response()
substanced/folder/views.py:383: in get_redirect_response
    _query=qs)
lib/python3.4/site-packages/pyramid/httpexceptions.py:459: in __init__
    body_template=body_template, location=location, **kw)
lib/python3.4/site-packages/pyramid/httpexceptions.py:219: in __init__
    Response.__init__(self, status=status, **kw)
lib/python3.4/site-packages/webob/response.py:153: in __init__
    setattr(self, name, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

r = <HTTPFound at 0x1060b99a8 302 Found>, value = <Mock name='mock.sdiapi.mgmt_path()' id='4396367264'>

    def fset(r, value):
        fdel(r)
        if value is not None:
>           if '\n' in value or '\r' in value:
E           TypeError: argument of type 'Mock' is not iterable
@Themanwithoutaplan
Copy link
Contributor Author

Zart has suggested a fix https://gist.github.com/zart/7f04d20814ba6c42b541

But I'm not sure if it wouldn't be better to set request.sdiapi = DummySDIAPI() I guess it depends on what needs observing.

stevepiercy added a commit to stevepiercy/substanced that referenced this issue Mar 18, 2016
stevepiercy added a commit to stevepiercy/substanced that referenced this issue Mar 18, 2016
stevepiercy added a commit that referenced this issue Mar 20, 2016
@stevepiercy
Copy link
Member

Fixed by #269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants