Exemple #1
0
    def test_it_returns_the_right_links(self, pyramid_config, pyramid_request):
        pyramid_config.add_route('account', '/account/settings')
        pyramid_config.add_route('forgot_password', '/forgot-password')
        pyramid_config.add_route('group_create', '/groups/new')
        pyramid_config.add_route('help', '/docs/help')
        pyramid_config.add_route('oauth_authorize', '/oauth/authorize')
        pyramid_config.add_route('oauth_revoke', '/oauth/revoke')
        pyramid_config.add_route('activity.search', '/search')
        pyramid_config.add_route('signup', '/signup')
        pyramid_config.add_route('stream.user_query', '/u/{user}')

        links = views.links(testing.DummyResource(), pyramid_request)

        host = 'http://example.com'  # Pyramid's default host URL.
        assert links == {
            'account.settings': host + '/account/settings',
            'forgot-password': host + '/forgot-password',
            'groups.new': host + '/groups/new',
            'help': host + '/docs/help',
            'oauth.authorize': host + '/oauth/authorize',
            'oauth.revoke': host + '/oauth/revoke',
            'search.tag': host + '/search?q=tag:":tag"',
            'signup': host + '/signup',
            'user': host + '/u/:user',
        }
Exemple #2
0
    def test_it_returns_the_right_links(self, pyramid_config, pyramid_request):
        pyramid_config.add_route('account', '/account/settings')
        pyramid_config.add_route('forgot_password', '/forgot-password')
        pyramid_config.add_route('group_leave', '/groups/{pubid}/leave')
        pyramid_config.add_route('group_create', '/groups/new')
        pyramid_config.add_route('help', '/docs/help')
        pyramid_config.add_route('activity.search', '/search')
        pyramid_config.add_route('signup', '/signup')
        pyramid_config.add_route('stream.user_query', '/u/{user}')

        links = views.links(testing.DummyResource(), pyramid_request)

        host = 'http://example.com'  # Pyramid's default host URL.
        assert links == {
            'account.settings': host + '/account/settings',
            'forgot-password': host + '/forgot-password',
            'groups.leave': host + '/groups/:id/leave',
            'groups.new': host + '/groups/new',
            'help': host + '/docs/help',
            'search.tag': host + '/search?q=tag:":tag"',
            'signup': host + '/signup',
            'user': host + '/u/:user',
        }