Exemple #1
0
    def test_it_redirects_to_user_activity_page(self, pyramid_request):
        pyramid_request.matchdict['user'] = '******'

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == 'http://example.com/user/bob'
Exemple #2
0
    def test_it_extracts_username_from_account_id(self, pyramid_request):
        pyramid_request.matchdict['user'] = '******'

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == 'http://example.com/user/bob'
Exemple #3
0
    def test_it_redirects_to_user_activity_page(self, pyramid_request):
        pyramid_request.matchdict["user"] = "******"

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == "http://example.com/user/bob"
Exemple #4
0
    def test_doesnt_choke_on_invalid_userids(self, pyramid_request):
        pyramid_request.matchdict['user'] = '******'

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == 'http://example.com/user/acct%3Abob'
Exemple #5
0
    def test_doesnt_choke_on_invalid_userids(self, pyramid_request):
        pyramid_request.matchdict["user"] = "******"

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == "http://example.com/user/acct:bob"
Exemple #6
0
    def test_it_extracts_username_from_account_id(self, pyramid_request):
        pyramid_request.matchdict["user"] = "******"

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == "http://example.com/user/bob"
Exemple #7
0
    def test_it_extracts_username_from_account_id(self, pyramid_request):
        pyramid_request.feature.flags['search_page'] = True
        pyramid_request.matchdict['user'] = '******'

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == 'http://example.com/user/bob/search'
Exemple #8
0
    def test_it_redirects_to_user_activity_page(self, pyramid_request):
        pyramid_request.feature.flags['search_page'] = True
        pyramid_request.matchdict['user'] = '******'

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == 'http://example.com/user/bob/search'
Exemple #9
0
    def test_it_redirects_to_stream(self, pyramid_request):
        pyramid_request.matchdict['user'] = '******'
        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream_user_redirect(pyramid_request)

        assert exc.value.location == 'http://example.com/stream?q=user%3Abob'