예제 #1
0
파일: panels_test.py 프로젝트: tetratorus/h
    def test_it_includes_search_url_when_on_user_search(self, req):
        type(req.matched_route).name = PropertyMock(
            return_value='activity.user_search')
        req.matchdict = {'username': '******'}

        result = panels.navbar({}, req)
        assert result['search_url'] == 'http://example.com/users/luke/search'
예제 #2
0
파일: panels_test.py 프로젝트: rmoorman/h
def test_navbar_username_link_when_logged_in(pyramid_request,
                                             authenticated_user):
    pyramid_request.authenticated_user = authenticated_user
    result = panels.navbar({}, pyramid_request)

    assert result[
        'username_link'] == 'http://example.com/search?q=user:vannevar'
예제 #3
0
파일: panels_test.py 프로젝트: tetratorus/h
    def test_it_includes_search_url_when_on_group_search(self, req):
        type(req.matched_route).name = PropertyMock(
            return_value='activity.group_search')
        req.matchdict = {'pubid': 'foobar'}

        result = panels.navbar({}, req)
        assert result[
            'search_url'] == 'http://example.com/groups/foobar/search'
예제 #4
0
파일: panels_test.py 프로젝트: nlisgo/h
    def test_it_lists_groups_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = panels.navbar({}, req)

        titles = [group.name for group in authenticated_user.groups]

        assert result['groups_menu_items'] == [
            {'title': titles[0], 'link': 'http://example.com/groups/id1/first'},
            {'title': titles[1], 'link': 'http://example.com/groups/id2/second'},
        ]
예제 #5
0
def test_navbar_lists_groups_when_logged_in(pyramid_request, authenticated_user):
    pyramid_request.authenticated_user = authenticated_user
    result = panels.navbar({}, pyramid_request)

    titles = [group.name for group in authenticated_user.groups]

    assert result["groups_menu_items"] == [
        {"title": titles[0], "link": "http://example.com/groups/id1/first"},
        {"title": titles[1], "link": "http://example.com/groups/id2/second"},
    ]
예제 #6
0
파일: panels_test.py 프로젝트: zermelozf/h
    def test_it_lists_groups_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = panels.navbar({}, req)

        titles = [group.name for group in authenticated_user.groups]

        assert result['groups_menu_items'] == [
            {'title': titles[0], 'link': 'http://example.com/groups/id1/first'},
            {'title': titles[1], 'link': 'http://example.com/groups/id2/second'},
        ]
예제 #7
0
파일: panels_test.py 프로젝트: nlisgo/h
 def test_it_sets_null_username_when_logged_out(self, req):
     result = panels.navbar({}, req)
     assert result['username'] is None
예제 #8
0
파일: panels_test.py 프로젝트: nlisgo/h
    def test_it_sets_username_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = panels.navbar({}, req)

        assert result['username'] == 'vannevar'
예제 #9
0
파일: panels_test.py 프로젝트: tetratorus/h
    def test_it_includes_search_query(self, req):
        req.params['q'] = 'tag:question'
        result = panels.navbar({}, req)

        assert result['q'] == 'tag:question'
예제 #10
0
파일: panels_test.py 프로젝트: tetratorus/h
    def test_username_url_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = panels.navbar({}, req)

        assert result[
            'username_url'] == 'http://example.com/users/vannevar/search'
예제 #11
0
파일: panels_test.py 프로젝트: tetratorus/h
    def test_it_sets_username_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = panels.navbar({}, req)

        assert result['username'] == 'vannevar'
예제 #12
0
파일: panels_test.py 프로젝트: nlisgo/h
    def test_it_includes_search_query(self, req):
        req.params['q'] = 'tag:question'
        result = panels.navbar({}, req)

        assert result['q'] == 'tag:question'
예제 #13
0
파일: panels_test.py 프로젝트: rmoorman/h
def test_navbar_sets_username_when_logged_in(pyramid_request,
                                             authenticated_user):
    pyramid_request.authenticated_user = authenticated_user
    result = panels.navbar({}, pyramid_request)

    assert result['username'] == 'vannevar'
예제 #14
0
def test_navbar_username_link_when_logged_in(pyramid_request, authenticated_user):
    pyramid_request.authenticated_user = authenticated_user
    result = panels.navbar({}, pyramid_request)

    assert result["username_link"] == "http://example.com/search?q=user:vannevar"
예제 #15
0
파일: panels_test.py 프로젝트: zermelozf/h
    def test_username_link_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = panels.navbar({}, req)

        assert result['username_link'] == 'http://example.com/search?q=user:vannevar'
예제 #16
0
def test_navbar_sets_username_when_logged_in(pyramid_request, authenticated_user):
    pyramid_request.authenticated_user = authenticated_user
    result = panels.navbar({}, pyramid_request)

    assert result["username"] == "vannevar"
예제 #17
0
def test_navbar_sets_null_username_when_logged_out(pyramid_request):
    pyramid_request.authenticated_user = None
    result = panels.navbar({}, pyramid_request)
    assert result["username"] == None
예제 #18
0
파일: panels_test.py 프로젝트: nlisgo/h
 def test_it_includes_default_search_url(self, req):
     result = panels.navbar({}, req)
     assert result['search_url'] == 'http://example.com/search'
예제 #19
0
파일: panels_test.py 프로젝트: nlisgo/h
    def test_it_includes_search_url_when_on_group_search(self, req):
        type(req.matched_route).name = PropertyMock(return_value='activity.group_search')
        req.matchdict = {'pubid': 'foobar'}

        result = panels.navbar({}, req)
        assert result['search_url'] == 'http://example.com/groups/foobar/search'
예제 #20
0
파일: panels_test.py 프로젝트: nlisgo/h
    def test_it_includes_search_url_when_on_user_search(self, req):
        type(req.matched_route).name = PropertyMock(return_value='activity.user_search')
        req.matchdict = {'username': '******'}

        result = panels.navbar({}, req)
        assert result['search_url'] == 'http://example.com/users/luke/search'
예제 #21
0
파일: panels_test.py 프로젝트: tetratorus/h
 def test_it_includes_default_search_url(self, req):
     result = panels.navbar({}, req)
     assert result['search_url'] == 'http://example.com/search'
예제 #22
0
파일: panels_test.py 프로젝트: rmoorman/h
def test_navbar_sets_null_username_when_logged_out(pyramid_request):
    pyramid_request.authenticated_user = None
    result = panels.navbar({}, pyramid_request)
    assert result['username'] == None
예제 #23
0
def test_navbar_includes_search_query(pyramid_request):
    pyramid_request.authenticated_user = None
    pyramid_request.params["q"] = "tag:question"
    result = panels.navbar({}, pyramid_request)

    assert result["q"] == "tag:question"
예제 #24
0
파일: panels_test.py 프로젝트: tetratorus/h
 def test_it_sets_null_username_when_logged_out(self, req):
     result = panels.navbar({}, req)
     assert result['username'] is None
예제 #25
0
파일: panels_test.py 프로젝트: nlisgo/h
    def test_username_url_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = panels.navbar({}, req)

        assert result['username_url'] == 'http://example.com/users/vannevar/search'