Beispiel #1
0
    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 = navbar({}, req)
        assert result["search_url"] == "http://example.com/users/luke"
Beispiel #2
0
 def test_includes_groups_suggestions_when_logged_in(self, req, user, open_group):
     req.user = user
     result = navbar({}, req)
     assert result['groups_suggestions'] == [{'name': g.name,
                                              'pubid': g.pubid,
                                              'relationship': 'Creator' if g.creator == user else None}
                                             for g in user.groups]
Beispiel #3
0
    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 = navbar({}, req)
        assert result['search_url'] == 'http://example.com/users/luke'
Beispiel #4
0
    def test_it_includes_search_url_when_on_group_search(self, req):
        type(req.matched_route).name = PropertyMock(return_value='group_read')
        req.matchdict = {'pubid': 'foobar', 'slug': 'slugbar'}

        result = navbar({}, req)
        assert result[
            'search_url'] == 'http://example.com/groups/foobar/slugbar'
Beispiel #5
0
    def test_it_includes_search_url_when_on_group_search(self, req):
        type(req.matched_route).name = PropertyMock(return_value="group_read")
        req.matchdict = {"pubid": "foobar", "slug": "slugbar"}

        result = navbar({}, req)
        assert result[
            "search_url"] == "http://example.com/groups/foobar/slugbar"
Beispiel #6
0
 def test_includes_groups_suggestions_when_logged_in(
         self, req, user, open_group):
     req.user = user
     result = navbar({}, req)
     assert result['groups_suggestions'] == [{
         'name': g.name,
         'pubid': g.pubid
     } for g in user.groups]
Beispiel #7
0
    def test_it_lists_groups_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result['groups_menu_items'] == [
            {'title': g.name, 'link': 'http://example.com/groups/' + g.pubid + '/' + g.slug}
            for g in user.groups
        ]
Beispiel #8
0
    def test_it_lists_groups_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result['groups_menu_items'] == [
            {'title': g.name, 'link': 'http://example.com/groups/' + g.pubid + '/' + g.slug}
            for g in user.groups
        ]
Beispiel #9
0
    def test_it_lists_groups_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = navbar({}, req)

        assert result["groups_menu_items"] == [
            {"title": g.name, "link": "http://example.com/groups/" + g.pubid + "/" + g.slug}
            for g in authenticated_user.groups
        ]
Beispiel #10
0
    def test_includes_groups_suggestions_when_logged_in(
            self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = navbar({}, req)

        assert result['groups_suggestions'] == [{
            'name': g.name,
            'pubid': g.pubid
        } for g in authenticated_user.groups]
Beispiel #11
0
    def test_it_lists_groups_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result["groups_menu_items"] == [{
            "title":
            g.name,
            "link":
            "http://example.com/groups/" + g.pubid + "/" + g.slug,
        } for g in user.groups]
Beispiel #12
0
 def test_includes_groups_suggestions_when_logged_in(self, req, user, open_group):
     req.user = user
     result = navbar({}, req)
     assert result["groups_suggestions"] == [
         {
             "name": g.name,
             "pubid": g.pubid,
             "relationship": "Creator" if g.creator == user else None,
         }
         for g in user.groups
     ]
Beispiel #13
0
 def test_includes_groups_suggestions_when_logged_in(self, req, user, open_group):
     req.user = user
     result = navbar({}, req)
     assert result["groups_suggestions"] == [
         {
             "name": g.name,
             "pubid": g.pubid,
             "relationship": "Creator" if g.creator == user else None,
         }
         for g in user.groups
     ]
Beispiel #14
0
 def test_it_sets_null_username_when_logged_out(self, req):
     result = navbar({}, req)
     assert result["username"] is None
Beispiel #15
0
    def test_username_url_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = navbar({}, req)

        assert result['username_url'] == 'http://example.com/users/vannevar'
Beispiel #16
0
    def test_includes_groups_suggestions_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result['groups_suggestions'] == [{'name': g.name, 'pubid': g.pubid}
                                                for g in user.groups]
Beispiel #17
0
    def test_it_includes_search_query(self, req):
        req.params['q'] = 'tag:question'
        result = navbar({}, req)

        assert result['q'] == 'tag:question'
Beispiel #18
0
    def test_it_includes_search_query(self, req):
        req.params['q'] = 'tag:question'
        result = navbar({}, req)

        assert result['q'] == 'tag:question'
Beispiel #19
0
 def test_it_sets_null_username_when_logged_out(self, req):
     result = navbar({}, req)
     assert result["username"] is None
Beispiel #20
0
 def test_it_includes_default_search_url(self, req):
     result = navbar({}, req)
     assert result["search_url"] == "http://example.com/search"
Beispiel #21
0
    def test_it_includes_search_url_when_on_group_search(self, req):
        type(req.matched_route).name = PropertyMock(return_value="group_read")
        req.matchdict = {"pubid": "foobar", "slug": "slugbar"}

        result = navbar({}, req)
        assert result["search_url"] == "http://example.com/groups/foobar/slugbar"
Beispiel #22
0
    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 = navbar({}, req)
        assert result['search_url'] == 'http://example.com/users/luke'
Beispiel #23
0
 def test_it_includes_default_search_url(self, req):
     result = navbar({}, req)
     assert result["search_url"] == "http://example.com/search"
Beispiel #24
0
    def test_it_includes_search_url_when_on_group_search(self, req):
        type(req.matched_route).name = PropertyMock(return_value='group_read')
        req.matchdict = {'pubid': 'foobar', 'slug': 'slugbar'}

        result = navbar({}, req)
        assert result['search_url'] == 'http://example.com/groups/foobar/slugbar'
Beispiel #25
0
    def test_username_url_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result["username_url"] == "http://example.com/users/vannevar"
Beispiel #26
0
    def test_it_sets_username_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result["username"] == "vannevar"
Beispiel #27
0
    def test_it_sets_username_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result["username"] == "vannevar"
Beispiel #28
0
 def test_it_includes_default_search_url_if_no_matched_route(self, req):
     req.matched_route = None
     result = navbar({}, req)
     assert result["search_url"] == "http://example.com/search"
Beispiel #29
0
    def test_includes_groups_suggestions_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = navbar({}, req)

        assert result["groups_suggestions"] == [{"name": g.name, "pubid": g.pubid} for g in authenticated_user.groups]
Beispiel #30
0
    def test_it_includes_search_query(self, req):
        req.params["q"] = "tag:question"
        result = navbar({}, req)

        assert result["q"] == "tag:question"
Beispiel #31
0
    def test_username_url_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

        assert result["username_url"] == "http://example.com/users/vannevar"
Beispiel #32
0
    def test_it_includes_search_query(self, req):
        req.params["q"] = "tag:question"
        result = navbar({}, req)

        assert result["q"] == "tag:question"
Beispiel #33
0
    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 = navbar({}, req)
        assert result["search_url"] == "http://example.com/users/luke"
Beispiel #34
0
 def test_it_includes_default_search_url_if_no_matched_route(self, req):
     req.matched_route = None
     result = navbar({}, req)
     assert result["search_url"] == "http://example.com/search"
Beispiel #35
0
    def test_it_sets_username_when_logged_in(self, req, authenticated_user):
        req.authenticated_user = authenticated_user
        result = navbar({}, req)

        assert result['username'] == 'vannevar'