@@ -0,0 +1,1151 @@
+import sys%0Aimport os%0A%0Abrief = %22test a controller%22%0Aaliases = %5B'c'%5D%0A%0A%0Adef usage(argv0):%0A    print(%22Usage: %7B%7D test controller CONTROLLER_NAME%7C--list%7C--help%22.format(argv0))%0A    sys.exit(1)%0A%0A%0Aalias = %5B'm'%5D%0A%0A%0Adef execute(argv, argv0, engine):%0A    if not argv or '--help' in argv:%0A        usage(argv0)%0A%0A    os.environ%5B%22AIOWEB_ENV%22%5D = %22test%22%0A    environment = os.getenv(%22AIOWEB_ENV%22, %22development%22)%0A    os.environ.setdefault(%22AIOWEB_SETTINGS_MODULE%22, %22settings%22)%0A    import lib, inflection%0A    from aioweb import settings%0A%0A    controllers_dir = lib.dirs(settings, format=%5B%22tests_controllers%22%5D)%0A    controller = inflection.underscore(argv%5B0%5D)%0A    controller_path = os.path.join(controllers_dir, controller + %22.py%22)%0A%0A    if not controllers_dir:%0A        print(%22No model found!%22)%0A        sys.exit(0)%0A%0A    if '--list' in argv:%0A        %5Bprint(m%5B:-3%5D) for m in os.listdir(controllers_dir) if m.endswith(%22.py%22) and not m.startswith(%22__%22)%5D%0A%0A        sys.exit(0)%0A    test_file = os.path.join(controllers_dir, controller + %22.py%22)%0A    if not os.path.exists(test_file):%0A        print(%22No such file: %22 + test_file)%0A        sys.exit(1)%0A%0A    os.system(%22python3 %22 + test_file)%0A

test controller