Page MenuHomePhabricator

site_tests.TestLogPages.test_list_namespace() fails for HiddenKeyError
Closed, ResolvedPublic

Description

=================================== FAILURES ===================================
_______________________ TestLogPages.test_list_namespace _______________________

self = <tests.site_tests.TestLogPages testMethod=test_list_namespace>

    def test_list_namespace(self):
        """Test the deprecated site.logpages() when namespace is a list."""
>       le = list(self.site.logpages(namespace=[2, 3], number=10))

tests/site_tests.py:1326: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/site.py:4663: in logpages
    for entry in gen:
pywikibot/data/api.py:2988: in __iter__
    for result in self._extract_results(resultdata):
pywikibot/data/api.py:2939: in _extract_results
    if not self._check_result_namespace(result):
pywikibot/data/api.py:3238: in _check_result_namespace
    return result.ns() in self._namespaces
pywikibot/logentries.py:109: in ns
    return self.data['ns']
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'suppressed': '', 'type': 'newusers', 'actionhidden': '', 'comment': '', 'action': 'create', 'userhidden': '', 'timestamp': '2018-09-25T16:50:03Z', 'logid': 216656}
key = 'ns'

    def __missing__(self, key):
        """Debug when the key is missing."""
        pywikibot.debug(u"API log entry received:\n" + repr(self),
                        _logger)
        if ((key in ('ns', 'title', 'pageid', 'logpage', 'params', 'action')
             and 'actionhidden' in self)
                or (key == 'comment' and 'commenthidden' in self)
                or (key == 'user' and 'userhidden' in self)):
            raise HiddenKeyError(
                "Log entry ({0}) has a hidden '{1}' key and you don't have "
>               'permission to view it.'.format(self._type, key))
E           pywikibot.exceptions.HiddenKeyError: Log entry (newusers) has a hidden 'ns' key and you don't have permission to view it.

pywikibot/logentries.py:43: HiddenKeyError

https://api.travis-ci.org/v3/job/432436022/log.txt

Event Timeline

Xqt triaged this task as High priority.Sep 26 2018, 11:41 AM

Change 463049 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [test] Skip hidden log entry instead of failing tests

https://gerrit.wikimedia.org/r/463049

Change 463049 merged by jenkins-bot:
[pywikibot/core@master] [test] Skip hidden log entry instead of failing tests

https://gerrit.wikimedia.org/r/463049