@@ -0,0 +1,1915 @@
+%22%22%22%0AConfiguration status tests%0A%22%22%22%0A%0Aimport json%0A%0Aimport requests%0A%0Afrom flask import abort, request%0Afrom flask_security import login_required%0Afrom requests.exceptions import RequestException%0A%0Afrom dockci.server import APP, CONFIG%0A%0A%0A@APP.route('/test/%3Cpart%3E.json')%0A@login_required%0Adef test_view(part):%0A    %22%22%22%0A    Run tests on a variety of config values%0A    %22%22%22%0A    if part == 'registry':%0A        results = RegistryTests(request.args.get('url', None)).all_tests()%0A%0A    else:%0A        return abort(404)%0A%0A    return json.dumps(results)%0A%0A%0Aclass Tester(object):  # pylint:disable=too-few-public-methods%0A    %22%22%22%0A    Base class for running generic tests against config%0A    %22%22%22%0A    def all_tests(self):%0A        %22%22%22%0A        Run all methods on this object that end in _test, returning results%0A        %22%22%22%0A        data = %7B%0A            test: getattr(self, '%25s_test' %25 test)()%0A            for test in %5B%0A                fn_name%5B:-5%5D%0A                for fn_name in dir(self)%0A                if fn_name%5B-5:%5D == '_test'%0A            %5D%0A        %7D%0A        return %7B%0A            test_name: %7B'result': test_result, 'detail': test_detail%7D%0A            for test_name, (test_result, test_detail) in data.items()%0A        %7D%0A%0A%0Aclass RegistryTests(Tester):  # pylint:disable=too-few-public-methods%0A    %22%22%22%0A    Class to run tests against a registry URL%0A    %22%22%22%0A    def __init__(self, url=None):%0A        if url is None:%0A            url = CONFIG.docker_registry%0A%0A        self.url = url%0A%0A    def api_test(self):%0A        %22%22%22%0A        Basic test of the registry v2 endpoint%0A        %22%22%22%0A        try:%0A            resp = requests.get('%25s/v2/' %25 self.url)%0A%0A        except RequestException as ex:%0A            return False, %22%7Bexname%7D: %7Bmessage%7D%22.format(%0A                exname=ex.__class__.__name__, message=ex,%0A            )%0A%0A        if resp.status_code != 200:%0A            return False, %22HTTP %25s: %25s%22 %25 (resp.status_code, resp.reason)%0A%0A        return True, ''%0A

Add forgotten view file