Example #1
0
 def test_static_route(self, verbose, internal):
     sv = inspect.StringVisitor(verbose, internal)
     sr = inspect.inspect_static_routes(make_app())
     no_file = sr[1]
     assert sv.process(no_file) == '↦ {0.prefix} {0.directory}'.format(no_file)
     with_file = sr[0]
     exp = '↦ {0.prefix} {0.directory} [{0.fallback_filename}]'.format(with_file)
     assert sv.process(with_file) == exp
Example #2
0
    def test_static_routes(self, asgi):
        routes = inspect.inspect_static_routes(make_app_async() if asgi else make_app())

        assert all(isinstance(sr, inspect.StaticRouteInfo) for sr in routes)
        assert routes[-1].prefix == '/fal/'
        assert routes[-1].directory == os.path.abspath('falcon')
        assert routes[-1].fallback_filename is None
        assert routes[-2].prefix == '/tes/'
        assert routes[-2].directory == os.path.abspath('tests')
        assert routes[-2].fallback_filename.endswith('conftest.py')