Test coverage for vnccollab.content.browser.author

vnccollab/      covered 92% (31 of 409 uncovered)
    content/      covered 92% (31 of 409 uncovered)
        browser/      covered 97% (4 of 145 uncovered)
            author.py      covered 88% (3 of 25 uncovered)

    1: from plone import api
    1: from Products.Five.browser import BrowserView
       
    1: from vnccollab.content import messageFactory as _
       
    1: AUTHOR_TABS_KEY = 'vncollab.content.author_tab_list'
       
       
    2: class AuthorView(BrowserView):
       
    1:     def __init__(self, context, request):
    5:         BrowserView.__init__(self, context, request)
    5:         self.uid = self.request.form.get('uid', '')
       
    1:     def tabs_info(self):
               """Returns a string representing the dynamic tabs in author.cpt."""
    5:         return self.get_tabs_info(self.uid)
       
    1:     def get_tabs_info(self, uid):
               """Returns a list with info about the dynamic tabs for author.cpt.
       
               The list consist in a tuple of (title, url), obtained from the
               registry. The registry contains lines of the form:
       
                   title::path
       
               The title is localized and the path is converted into an URL, after
               replacing certain strings with the arguments of this method.
               Currently the list of replacements is:
       
                   '{%uid}': Replaced by the uid argument.
               """
       
    5:         try:
    5:             info = api.portal.get_registry_record(AUTHOR_TABS_KEY)
>>>>>> except api.exc.InvalidParameterError:
>>>>>> return []
5: base_url = api.portal.get().absolute_url() 5: tabs = [] 15: for line in info: 10: title, path, mode = (line.split('::') + ['', '', ''])[:3] 10: if not title or not path:
>>>>>> continue
10: path = path.replace('{%uid}', uid) 10: url = '{0}/{1}'.format(base_url, path) 10: tabs.append((_(title), url, mode)) 5: return tabs