コード例 #1
0
ファイル: groups_test.py プロジェクト: gnott/h
    def test_redirects_if_slug_incorrect(self, pyramid_request):
        group = FakeGroup('abc123', 'some-slug')
        pyramid_request.matchdict['slug'] = 'another-slug'

        with pytest.raises(HTTPMovedPermanently) as exc:
            views.read_unauthenticated(group, pyramid_request)

        assert exc.value.location == '/g/abc123/some-slug'
コード例 #2
0
ファイル: groups_test.py プロジェクト: ssin122/test-h
    def test_redirects_if_slug_incorrect(self, pyramid_request):
        group = FakeGroup('abc123', 'some-slug')
        pyramid_request.matchdict['slug'] = 'another-slug'

        with pytest.raises(httpexceptions.HTTPMovedPermanently) as exc:
            views.read_unauthenticated(group, pyramid_request)

        assert exc.value.location == '/g/abc123/some-slug'
コード例 #3
0
ファイル: groups_test.py プロジェクト: gnott/h
    def test_returns_template_context(self, pyramid_request):
        group = FakeGroup('abc123', 'some-slug')
        pyramid_request.matchdict['slug'] = 'some-slug'

        result = views.read_unauthenticated(group, pyramid_request)

        assert result == {'group': group}
コード例 #4
0
ファイル: groups_test.py プロジェクト: ssin122/test-h
    def test_returns_template_context(self, pyramid_request):
        group = FakeGroup('abc123', 'some-slug')
        pyramid_request.matchdict['slug'] = 'some-slug'

        result = views.read_unauthenticated(group, pyramid_request)

        assert result == {'group': group}
コード例 #5
0
ファイル: groups_test.py プロジェクト: gnott/h
    def test_raises_not_found_when_not_joinable(self, pyramid_request):
        group = FakeGroup('abc123', 'some-slug', joinable_by=None)
        pyramid_request.matchdict['slug'] = 'some-slug'

        with pytest.raises(HTTPNotFound):
            views.read_unauthenticated(group, pyramid_request)
コード例 #6
0
ファイル: groups_test.py プロジェクト: ssin122/test-h
    def test_raises_not_found_when_not_joinable(self, pyramid_request):
        group = FakeGroup('abc123', 'some-slug', joinable_by=None)
        pyramid_request.matchdict['slug'] = 'some-slug'

        with pytest.raises(httpexceptions.HTTPNotFound):
            views.read_unauthenticated(group, pyramid_request)