tests: comprehensively test HTTP server permissions checking
We didn't have test coverage for numerous web.* config options. We
add that test coverage.
Included in the tests are tests for custom commands. We have commands
that are supposedly read-only and perform writes and a variation of
each that does and does not define its operation type in
hgweb_mod.perms.
The tests reveal a handful of security bugs related to permissions
checking. Subsequent commits will address these security bugs.
from __future__ import absolute_import
import os
import time
class mocktime(object):
def __init__(self, increment):
self.time = 0
self.increment = [float(s) for s in increment.split()]
self.pos = 0
def __call__(self):
self.time += self.increment[self.pos % len(self.increment)]
self.pos += 1
return self.time
def uisetup(ui):
time.time = mocktime(os.environ.get('MOCKTIME', '0.1'))