Example #1
0
    def test_created_app_persists(self):
        rv = self.login("testuser", "password")

        # import readline # optional, will allow Up/Down/History in the console
        # import code
        # vars = globals().copy()
        # vars.update(locals())
        # shell = code.InteractiveConsole(vars)
        # shell.interact()

        # Create an App for the tests.
        self.tapp = api.create_app("UTApp", "dummy", None, "{}")
        self.tapp = api.get_app_by_name("UTApp")
        api.set_var(self.tapp, "TestVar", "TestValue")

        rv = self.login("testuser", "password")
        app = api.get_app_by_name("UTApp")

        assert app is not None

        vars = api.get_all_vars(app)

        assert len(vars) == 1

        var = vars[0]

        assert var.name == "TestVar"
        assert var.value == "TestValue"
Example #2
0
    def test_created_app_persists(self):
        rv = self.login("testuser", "password")

        # import readline # optional, will allow Up/Down/History in the console
        # import code
        # vars = globals().copy()
        # vars.update(locals())
        # shell = code.InteractiveConsole(vars)
        # shell.interact()

        # Create an App for the tests.
        self.tapp = api.create_app("UTApp", "dummy", None, "{}")
        self.tapp = api.get_app_by_name("UTApp")
        api.set_var(self.tapp, "TestVar", "TestValue")

        rv = self.login("testuser", "password")
        app = api.get_app_by_name("UTApp")

        assert app is not None

        vars = api.get_all_vars(app)

        assert len(vars) == 1

        var = vars[0]

        assert var.name == "TestVar"
        assert var.value == "TestValue"
    def setUp(self):
        appcomposer.app.config['DEBUG'] = True
        appcomposer.app.config['TESTING'] = True
        appcomposer.app.config['CSRF_ENABLED'] = False
        appcomposer.app.config["SECRET_KEY"] = 'secret'
        self.flask_app = appcomposer.app.test_client()

        self.flask_app.__enter__()

        # In case the test failed before, start from a clean state.
        self._cleanup()

        self.flask_app.get("/")
        rv = self.login("testuser", "password")

        # Create the PARENT app
        url = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url},
                                 follow_redirects=True)

        # Create the CHILDREN app
        url = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp2", "appurl": url},
                                 follow_redirects=True)

        # We need to be in the flask client context to get app by name.
        self.flask_app.get("/")
        self.firstApp = get_app_by_name("UTApp")
        self.secondApp = get_app_by_name("UTApp2")
    def setUp(self):
        appcomposer.app.config['DEBUG'] = True
        appcomposer.app.config['TESTING'] = True
        appcomposer.app.config['CSRF_ENABLED'] = False
        appcomposer.app.config["SECRET_KEY"] = 'secret'
        self.flask_app = appcomposer.app.test_client()

        self.flask_app.__enter__()

        # In case the test failed before, start from a clean state.
        self._cleanup()

        self.flask_app.get("/")
        rv = self.login("testuser", "password")

        # Create the PARENT app
        url = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url}, follow_redirects=True)

        # Create the CHILDREN app
        url = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp2", "appurl": url}, follow_redirects=True)

        # We need to be in the flask client context to get app by name.
        self.flask_app.get("/")
        self.firstApp = get_app_by_name("UTApp")
        self.secondApp = get_app_by_name("UTApp2")

        # *** Force the creation of a proposal into the firstApp (the parent app).
        # Set Autoaccept to False
        url = u"/composers/translate/config/autoaccept/" + self.firstApp.unique_id
        rv = self.flask_app.post(url, data={"value": 0})
        assert rv.status_code == 200
        # Edit the child app and propose changes.
        url = u"/composers/translate/edit?appid=%s&srclang=all_ALL&editSelectedSourceButton=&targetlang=all_ALL&srcgroup=ALL&targetgroup=ALL" % (self.secondApp.unique_id)
        rv = self.flask_app.get(url)
        posturl = u"/composers/translate/edit?appid=%s&srclang=all_ALL&editSelectedSourceButton=&targetlang=all_ALL&srcgroup=ALL&targetgroup=ALL" % self.secondApp.unique_id
        postdata = {"appid": self.secondApp.unique_id,
                    "srclang": "all_ALL",
                    "targetlang": "all_ALL",
                    "srcgroup": "ALL",
                    "targetgroup": "ALL",
                    "_message_blue": "Blue",
                    "_message_hello_world": "Hello Test World",
                    "save": "",
                    "proposeToOwner": "true"}
        rv = self.flask_app.post(posturl, data=postdata)
        self.assertEquals(302, rv.status_code)

        # Access the parent's selectlang to see the proposal button.
        url = u"/composers/translate/edit?appid=%s&srclang=all_ALL&editSelectedSourceButton=&targetlang=all_ALL&srcgroup=ALL&targetgroup=ALL" % (self.firstApp.unique_id)
        rv = self.flask_app.get(url)
        assert rv.status_code == 200
        data = rv.data.decode("utf8")  # This bypasses an apparent utf8 FlaskClient bug.
        assert """class="badge" style>1</span>"""
 def _cleanup(self):
     """
     Does cleanup tasks in case the tests failed before.
     Can be invoked *before* and *after* the tests.
     """
     app = api.get_app_by_name("UTApp")
     if app is not None:
         api.delete_app(app)
     app = api.get_app_by_name("UTAppDel")
     if app is not None:
         api.delete_app(app)
Example #6
0
def adapt_duplicate(appid):
    app = get_app(appid)
    if app is None:
        return render_template("composers/errors.html",
                               message="Application not found")

    form = DuplicationForm()

    if form.validate_on_submit():

        # Protect against CSRF attacks.
        if not verify_csrf(request):
            return render_template(
                "composers/errors.html",
                message=
                "Request does not seem to come from the right source (csrf check)"
            ), 400

        existing_app = get_app_by_name(form.name.data)
        if existing_app:
            if not form.name.errors:
                form.name.errors = []
            form.name.errors.append(
                lazy_gettext("You already have an application with this name"))
        else:
            new_app = create_app(form.name.data, 'adapt', app.spec.url,
                                 app.data)
            for appvar in app.appvars:  # Copy every appvar for the original app as well.
                add_var(new_app, appvar.name, appvar.value)

            return redirect(url_for('.adapt_edit', appid=new_app.unique_id))

    if not form.name.data:
        counter = 2
        potential_name = ''
        while counter < 1000:
            potential_name = '%s (%s)' % (app.name, counter)

            existing_app = get_app_by_name(potential_name)
            if not existing_app:
                break
            counter += 1

        form.name.data = potential_name

    return render_template("composers/adapt/duplicate.html",
                           form=form,
                           app=app)
    def test_translate_local_sync_creation_selectlang(self):
        """
        Ensure that we can create an app normally through a synchronous POST request to SELECTLANG.
        Note that this test relies on the accessibility of a local i18n.xml file.
        """
        url = "appcomposer/tests_data/googleExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url}, follow_redirects=True)

        # Check whether it seems to be the page we expect.
        assert rv.status_code == 200  # Page found code.
        assert rv.data.count("option") > 100  # Lots of them, because of the languages list.
        assert "submit" in rv.data

        # Check that we did indeed create the app properly.
        with self.flask_app:
            self.flask_app.get("/")
            app = api.get_app_by_name("UTApp")

            assert app is not None
            appdata = app.data

            data = json.loads(appdata)

            assert "spec" in data
            assert url == data["spec"]

            full_app_data = load_appdata_from_db(app)
            bm = BundleManager.create_from_existing_app(full_app_data)

            assert bm.get_gadget_spec() == url
            assert len(bm._bundles) > 3

            defaultBundle = bm.get_bundle("all_ALL_ALL")
            assert defaultBundle is not None
            assert len(defaultBundle.get_msgs()) > 6
Example #8
0
    def test_delete_app(self):
        app = api.create_app("UTAppDel", "dummy", None, "{}")
        assert app is not None

        api.delete_app(app)
        app = api.get_app_by_name("UTAppDel")
        assert app is None
    def test_celery_sync_delete(self):

        # Create test apps so that they are in the DB.
        self.login("testuser", "password")
        url = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post(
            "/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url}, follow_redirects=True
        )
        assert rv.status_code == 200  # Page found code.

        # Wait to be sure that they are not placed into the MongoDB early.
        time.sleep(2)

        with self.flask_app:
            self.flask_app.get("/")
            unid = get_app_by_name("UTApp").unique_id

        rv = self.flask_app.post(
            "/composers/translate/delete", data={"appid": unid, "delete": "Delete"}, follow_redirects=True
        )
        assert rv.status_code == 200

        # Sync through celery. May take a short while, it is asynchronous and
        # it issues asynchronous tasks.
        pusher.sync.delay()
        time.sleep(2)

        # Check that our new app got added to the DB.
        appurl = "appcomposer/tests_data/relativeExample/i18n.xml"
        bundles = pusher.mongo_bundles
        f = bundles.find_one({"spec": appurl})
        assert f is None
    def test_delete_app(self):
        app = api.create_app("UTAppDel", "dummy", "{}")
        assert app is not None

        api.delete_app(app)
        app = api.get_app_by_name("UTAppDel")
        assert app is None
Example #11
0
    def _cleanup(self):
        """
        Does cleanup tasks in case the tests failed before.
        Can be invoked *before* and *after* the tests.
        """
        app = api.get_app_by_name("UTApp")
        if app is not None:
            api.delete_app(app)
        app = api.get_app_by_name("UTAppDel")
        if app is not None:
            api.delete_app(app)

        # Remove the Spec that may exist.
        spec = api.db.session.query(Spec).filter_by(url="http://myurl.com").first()
        if spec is not None:
            api.db.session.delete(spec)
            api.db.session.commit()
    def test_data_save(self):
        data = {"MYNAME": "TEST"}
        api.update_app_data(self.tapp, json.dumps(data))

        recdata = api.get_app_by_name("UTApp").data
        pdata = json.loads(recdata)

        assert data == pdata
    def test_data_save(self):
        data = {"MYNAME": "TEST"}
        api.update_app_data(self.tapp, json.dumps(data))

        recdata = api.get_app_by_name("UTApp").data
        pdata = json.loads(recdata)

        assert data == pdata
Example #14
0
 def _cleanup(self):
     """
     Does cleanup tasks in case the tests failed before.
     Can be invoked *before* and *after* the tests.
     """
     app = api.get_app_by_name("UTApp")
     if app is not None:
         api.delete_app(app)
Example #15
0
    def test_mongodb_pusher_at_app_edit_non_owner_propose_enabled(self):
        """
        Ensures that when an existing app is edited, if the language is not the owner, but autoproposals are enabled
        (by default) and a proposal is done, then the changes are applied and reported to the MongoDB.
        """
        # Create the FIRST (owner) test app
        self.login("testuser", "password")
        appurl = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": appurl},
                                 follow_redirects=True)
        assert rv.status_code == 200  # Page found code.

        # Create the SECOND (non-owner) test app
        self.login("testuser", "password")
        appurl = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTAppChild", "appurl": appurl},
                                 follow_redirects=True)
        assert rv.status_code == 200  # Page found code.
        with self.flask_app:
            self.flask_app.get("/")
            testAppID = get_app_by_name("UTAppChild").unique_id

        # Edit the test app
        url = u"/composers/translate/edit?appid=%s&srclang=all_ALL&editSelectedSourceButton=&targetlang=all_ALL&srcgroup=ALL&targetgroup=ALL" % (
            testAppID)
        print "URL: " + url
        rv = self.flask_app.get(url)
        assert rv.status_code == 200
        data = rv.data.decode("utf8")  # This bypasses an apparent utf8 FlaskClient bug.

        posturl = u"/composers/translate/edit?appid=%s&srclang=all_ALL&editSelectedSourceButton=&targetlang=all_ALL&srcgroup=ALL&targetgroup=ALL" % testAppID
        postdata = {"appid": testAppID,
                    "srclang": "all_ALL",
                    "targetlang": "all_ALL",
                    "srcgroup": "ALL",
                    "targetgroup": "ALL",
                    "_message_blue": "Blue",
                    "_message_hello_world": "Hello Test World",
                    "save_exit": "",
                    "proposeToOwner": ""
                    }
        rv = self.flask_app.post(posturl, data=postdata)
        assert rv.status_code == 302

        # Ensure that after a short while we have all the bundles in the MongoDB and the changes have been applied.
        time.sleep(2)

        bundles = pusher.mongo_bundles.find({"spec": appurl})
        bundles = {b["bundle"]: b for b in bundles}
        print bundles
        assert len(bundles) == 2

        data = bundles["all_ALL_ALL"]["data"]
        data = json.loads(data)

        # Test that the changes have been applied. This is expected, because though the modified lang was
        # the child, a proposal was sent and proposals are by default set to autoaccept.
        assert data["hello_world"] == "Hello Test World"
Example #16
0
 def _cleanup(self):
     """
     Does cleanup tasks in case the tests failed before.
     Can be invoked *before* and *after* the tests.
     """
     self.client.get("/")
     app = get_app_by_name("TestApp")
     if app is not None:
         api.delete_app(app)
    def _cleanup(self):
        """
        Does cleanup tasks in case the tests failed before.
        Can be invoked *before* and *after* the tests,
        and it is meant to be idempotent.
        """
        pusher.mongo_bundles.remove({"spec": "appcomposer/tests_data/relativeExample/i18n.xml"})
        pusher.mongo_bundles.remove({"bundle": "test_TEST_TEST"})
        pusher.mongo_bundles.remove({"bundle": "test_CELERYTEST_ALL"})

        with self.flask_app:
            self.flask_app.get("/")  # This is required to create a context. Otherwise session etc don't exist.
            app = api.get_app_by_name("UTApp")
            if app is not None:
                api.delete_app(app)
            app = api.get_app_by_name("UTAppChild")
            if app is not None:
                api.delete_app(app)
 def _cleanup(self):
     """
     Does cleanup tasks in case the tests failed before.
     Can be invoked *before* and *after* the tests.
     """
     self.flask_app.get("/")  # This is required to create a context. Otherwise session etc don't exist.
     app = api.get_app_by_name("UTApp")
     if app is not None:
         api.delete_app(app)
    def test_mongodb_pusher_at_app_edit(self):
        """
        Ensures that when an existing app is edited, the changes are reflected into the MongoDB.
        """
        # Create the test app
        self.login("testuser", "password")
        appurl = "appcomposer/tests_data/relativeExample/i18n.xml"
        rv = self.flask_app.post(
            "/composers/translate/selectlang", data={"appname": "UTApp", "appurl": appurl}, follow_redirects=True
        )
        assert rv.status_code == 200  # Page found code.
        with self.flask_app:
            self.flask_app.get("/")
            testAppID = get_app_by_name("UTApp").unique_id

        # Edit the test app
        url = (
            u"/composers/translate/edit?appid=%s&srclang=all_ALL&editSelectedSourceButton=&targetlang=all_ALL&srcgroup=ALL&targetgroup=ALL"
            % (testAppID)
        )
        print "URL: " + url
        rv = self.flask_app.get(url)
        assert rv.status_code == 200
        data = rv.data.decode("utf8")  # This bypasses an apparent utf8 FlaskClient bug.

        posturl = (
            u"/composers/translate/edit?appid=%s&srclang=all_ALL&editSelectedSourceButton=&targetlang=all_ALL&srcgroup=ALL&targetgroup=ALL"
            % testAppID
        )
        postdata = {
            "appid": testAppID,
            "srclang": "all_ALL",
            "targetlang": "all_ALL",
            "srcgroup": "ALL",
            "targetgroup": "ALL",
            "_message_blue": "Blue",
            "_message_hello_world": "Hello Test World",
            "save_exit": "",
        }
        rv = self.flask_app.post(posturl, data=postdata)
        assert rv.status_code == 302

        # Ensure that after a short while we have all the bundles in the MongoDB and the changes have been applied.
        time.sleep(2)

        bundles = pusher.mongo_bundles.find({"spec": appurl})
        bundles = {b["bundle"]: b for b in bundles}
        print "BUNDLES: ", bundles
        assert len(bundles) == 2

        data = bundles["all_ALL_ALL"]["data"]
        data = json.loads(data)

        # Test that the changes have been applied.
        print data
        assert data["hello_world"] == "Hello Test World"
Example #20
0
 def _cleanup(self):
     """
     Does cleanup tasks in case the tests failed before.
     Can be invoked *before* and *after* the tests.
     """
     self.client.get("/")  # Required so that we have a ready session
     rv = self.login("testuser", "password")
     app = api.get_app_by_name("UTApp")
     if app is not None:
         api.delete_app(app)
Example #21
0
 def _cleanup(self):
     """
     Does cleanup tasks in case the tests failed before.
     Can be invoked *before* and *after* the tests.
     """
     self.client.get("/")  # Required so that we have a ready session
     rv = self.login("testuser", "password")
     app = api.get_app_by_name("UTApp")
     if app is not None:
         api.delete_app(app)
Example #22
0
def adapt_duplicate(appid):
    app = get_app(appid)
    if app is None:
        return render_template("composers/errors.html", message="Application not found")

    form = DuplicationForm()

    if form.validate_on_submit():

        # Protect against CSRF attacks.
        if not verify_csrf(request):
            return render_template("composers/errors.html",
                                   message="Request does not seem to come from the right source (csrf check)"), 400

        existing_app = get_app_by_name(form.name.data)
        if existing_app:
            if not form.name.errors:
                form.name.errors = []
            form.name.errors.append(lazy_gettext("You already have an application with this name"))
        else:
            new_app = create_app(form.name.data, 'adapt', app.spec.url, app.data)
            for appvar in app.appvars:  # Copy every appvar for the original app as well.
                add_var(new_app, appvar.name, appvar.value)

            return redirect(url_for('.adapt_edit', appid=new_app.unique_id))

    if not form.name.data:
        counter = 2
        potential_name = ''
        while counter < 1000:
            potential_name = '%s (%s)' % (app.name, counter)

            existing_app = get_app_by_name(potential_name)
            if not existing_app:
                break
            counter += 1

        form.name.data = potential_name

    return render_template("composers/adapt/duplicate.html", form=form, app=app)
    def test_translate_create_app_with_empty_default(self):
        """
        [REGRESSION TEST: If the DEFAULT XML is an invalid fail or empty, it was not being handled nicely]
        Ensure that we can create an app normally through a synchronous POST request to SELECTLANG.
        """
        url = "appcomposer/tests_data/relativeExampleEmptyDefault/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url}, follow_redirects=True)

        # Check whether it seems to be the page we expect.
        assert rv.status_code == 200  # Page found code.
        assert rv.data.count("option") > 100  # Lots of them, because of the languages list.
        assert "submit" in rv.data
        assert "Localise" in rv.data

        # Check that we did indeed create the app properly.
        with self.flask_app:
            self.flask_app.get("/")
            app = api.get_app_by_name("UTApp")

            assert app is not None
            appdata = app.data
            assert len(appdata) > 500

            data = json.loads(appdata)

            assert "spec" in data
            assert url == data["spec"]

            bm = BundleManager.create_from_existing_app(appdata)

            assert bm.get_gadget_spec() == url

            # The bundles should be 3 (DEFAULT - copied from English, English, German).
            assert len(bm._bundles) == 3

            defaultBundle = bm.get_bundle("all_ALL_ALL")
            assert defaultBundle is not None
            assert len(defaultBundle.get_msgs()) > 6

            gerBundle = bm.get_bundle("de_ALL_ALL")
            assert gerBundle is not None
            assert len(gerBundle.get_msgs()) > 6

            enBundle = bm.get_bundle("en_ALL_ALL")
            assert enBundle is not None
            assert len(enBundle.get_msgs()) > 6

            # Ensure that the language that got copied as DEFAULT is really english
            assert enBundle.get_msgs()["hello_world"] == "Hello World."
            assert defaultBundle.get_msgs()["hello_world"] == "Hello World."
    def test_created_app_persists(self):
        self.flask_app = appcomposer.app.test_client()
        with self.flask_app:
            rv = self.login("testuser", "password")
            app = api.get_app_by_name("UTApp")

            assert app is not None

            vars = api.get_all_vars(app)

            assert len(vars) == 1

            var = vars[0]

            assert var.name == "TestVar"
            assert var.value == "TestValue"
    def test_translate_create_with_multi_bundle(self):
        """
        Ensure that we can create an app where the xml contains two different bundles for the same language.
        """
        url = "appcomposer/tests_data/relativeMultibundleExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url}, follow_redirects=True)

        # Check whether it seems to be the page we expect.
        assert rv.status_code == 200  # Page found code.
        assert rv.data.count("option") > 100  # Lots of them, because of the languages list.
        assert "submit" in rv.data
        assert "Localise" in rv.data

        # Check that we did indeed create the app properly.
        with self.flask_app:
            self.flask_app.get("/")
            app = api.get_app_by_name("UTApp")

            assert app is not None
            appdata = app.data
            assert len(appdata) > 500

            data = json.loads(appdata)

            assert "spec" in data
            assert url == data["spec"]

            bm = BundleManager.create_from_existing_app(appdata)

            assert bm.get_gadget_spec() == url
            assert len(bm._bundles) == 2

            defaultBundle = bm.get_bundle("all_ALL_ALL")
            assert defaultBundle is not None
            assert len(defaultBundle.get_msgs()) > 6

            gerBundle = bm.get_bundle("de_ALL_ALL")
            assert gerBundle is not None
            assert len(gerBundle.get_msgs()) > 6
            msgs = gerBundle.get_msgs()

            # Ensure the translations in the first file are present
            assert msgs["hello_world"] == "Hallo Welt."

            # Ensure the translations in the second file are present as well
            assert msgs["gray"] == "Grau"
    def test_creation_fails_on_local_file(self):
        """
        Ensure that we cannot create a file from a local app.xml when we are
        NOT in debug mode.
        """
        flask_app.config["DEBUG"] = False
        url = "appcomposer/tests_data/googleExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url},
                                 follow_redirects=True)

        # Check whether it seems to be the page we expect.
        assert rv.status_code != 200  # Page found code.

        # Check that we did indeed create the app properly.
        with self.flask_app:
            self.flask_app.get("/")
            app = api.get_app_by_name("UTApp")

            assert app is None
    def test_highlevel_obtain_translation_info(self):
        """
        Ensure that we can create an app and then load the translation info through obtain_translation_info(app).
        """
        url = "appcomposer/tests_data/googleExample/i18n.xml"
        rv = self.flask_app.post("/composers/translate/selectlang", data={"appname": "UTApp", "appurl": url}, follow_redirects=True)

        # Check whether it seems to be the page we expect.
        assert rv.status_code == 200  # Page found code.

        with self.flask_app:
            self.flask_app.get("/")
            app = api.get_app_by_name("UTApp")

            # Check that we can indeed obtain the translation info.
            translation_info = ops_highlevel.obtain_translation_info(app)

            assert translation_info is not None
            assert len(translation_info) > 3
    def setUp(self):
        appcomposer.app.config["DEBUG"] = True
        appcomposer.app.config["TESTING"] = True
        appcomposer.app.config["CSRF_ENABLED"] = False
        appcomposer.app.config["SECRET_KEY"] = "secret"

        self._cleanup()

        self.flask_app = appcomposer.app.test_client()
        with self.flask_app:
            rv = self.login("testuser", "password")

            # import readline # optional, will allow Up/Down/History in the console
            # import code
            # vars = globals().copy()
            # vars.update(locals())
            # shell = code.InteractiveConsole(vars)
            # shell.interact()

            # Create an App for the tests.
            self.tapp = api.create_app("UTApp", "dummy", None, "{}")
            self.tapp = api.get_app_by_name("UTApp")
            api.set_var(self.tapp, "TestVar", "TestValue")
    def setUp(self):
        appcomposer.app.config['DEBUG'] = True
        appcomposer.app.config['TESTING'] = True
        appcomposer.app.config['CSRF_ENABLED'] = False
        appcomposer.app.config["SECRET_KEY"] = 'secret'
        self.flask_app = appcomposer.app.test_client()
        self.flask_app.__enter__()

        rv = self.login("testuser", "password")

        # In case the test failed before, start from a clean state.
        self._cleanup()

        # import readline # optional, will allow Up/Down/History in the console
        # import code
        # vars = globals().copy()
        # vars.update(locals())
        # shell = code.InteractiveConsole(vars)
        # shell.interact()

        # Create an App for the tests.
        self.tapp = api.create_app("UTApp", "dummy", "{}")

        self.tapp = api.get_app_by_name("UTApp")