def test_inspect(self, verbose, internal, monkeypatch): args = ['some-file.py', '{}:{}'.format(_MODULE, '_APP')] if verbose: args.append('-v') if internal: args.append('-i') monkeypatch.setattr('sys.argv', args) output = io.StringIO() with redirected(stdout=output): inspect_app.main() ins = inspect.inspect_app(_APP) self.check(output.getvalue().strip(), ins.to_string(verbose, internal))
def test_routes_only(self, verbose, internal, monkeypatch): args = ['some-file.py', '{}:{}'.format(_MODULE, '_APP'), '-r'] if verbose: args.append('-v') if internal: args.append('-i') monkeypatch.setattr('sys.argv', args) output = io.StringIO() with redirected(stdout=output): inspect_app.main() routes = inspect.inspect_routes(_APP) sv = inspect.StringVisitor(verbose, internal) expect = '\n'.join([sv.process(r) for r in routes]) self.check(output.getvalue().strip(), expect)