Ejemplo n.º 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"
Ejemplo n.º 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]
Ejemplo n.º 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'
Ejemplo n.º 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'
Ejemplo n.º 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"
Ejemplo n.º 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]
Ejemplo n.º 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
        ]
Ejemplo n.º 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
        ]
Ejemplo n.º 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
        ]
Ejemplo n.º 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]
Ejemplo n.º 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]
Ejemplo n.º 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
     ]
Ejemplo n.º 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
     ]
Ejemplo n.º 14
0
 def test_it_sets_null_username_when_logged_out(self, req):
     result = navbar({}, req)
     assert result["username"] is None
Ejemplo n.º 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'
Ejemplo n.º 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]
Ejemplo n.º 17
0
    def test_it_includes_search_query(self, req):
        req.params['q'] = 'tag:question'
        result = navbar({}, req)

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

        assert result['q'] == 'tag:question'
Ejemplo n.º 19
0
 def test_it_sets_null_username_when_logged_out(self, req):
     result = navbar({}, req)
     assert result["username"] is None
Ejemplo n.º 20
0
 def test_it_includes_default_search_url(self, req):
     result = navbar({}, req)
     assert result["search_url"] == "http://example.com/search"
Ejemplo n.º 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"
Ejemplo n.º 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'
Ejemplo n.º 23
0
 def test_it_includes_default_search_url(self, req):
     result = navbar({}, req)
     assert result["search_url"] == "http://example.com/search"
Ejemplo n.º 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'
Ejemplo n.º 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"
Ejemplo n.º 26
0
    def test_it_sets_username_when_logged_in(self, req, user):
        req.user = user
        result = navbar({}, req)

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

        assert result["username"] == "vannevar"
Ejemplo n.º 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"
Ejemplo n.º 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]
Ejemplo n.º 30
0
    def test_it_includes_search_query(self, req):
        req.params["q"] = "tag:question"
        result = navbar({}, req)

        assert result["q"] == "tag:question"
Ejemplo n.º 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"
Ejemplo n.º 32
0
    def test_it_includes_search_query(self, req):
        req.params["q"] = "tag:question"
        result = navbar({}, req)

        assert result["q"] == "tag:question"
Ejemplo n.º 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"
Ejemplo n.º 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"
Ejemplo n.º 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'