Ejemplo n.º 1
0
    def test_db_init(self, capfd, tmpdir):  # TODO: needs validation
        with working_directory(tmpdir):
            manage.init(str(tmpdir), "")
            captured = capfd.readouterr()

        for line in captured.out.split("\n"):
            logger.info(line)
Ejemplo n.º 2
0
    def go():
        dialog = IDAngrConnectDialog()
        r = dialog.exec_()
        if r == QtWidgets.QDialog.Accepted:
            if dialog.ui.saveBox.isChecked():
                config = {
                    "host": dialog.ui.hostTxt.displayText(),
                    "port": int(dialog.ui.portTxt.displayText()),
                    "save": True,
                    "local": dialog.ui.localBox.isChecked()
                }
                mkpath(user_data_dir("IDAngr", "IDA Pro"))
                with open(config_file, "w") as f:
                    json.dump(config, f, indent=4)

            try:
                if dialog.ui.localBox.isChecked():
                    manage.init(use_pin=dialog.ui.pinBox.isChecked())
                else:
                    manage.init(True,
                                dialog.ui.hostTxt.displayText(),
                                int(dialog.ui.portTxt.displayText()),
                                use_pin=dialog.ui.pinBox.isChecked())
            except Exception as ee:
                QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical,
                                      'IDAngr init error', str(ee)).exec_()
                return False

            return True
        return False
Ejemplo n.º 3
0
    def setUpClass(cls):

        init()

        cls.dog_path = os.path.join(fixtures_path, 'dog_park_permits.csv')
        cls.radio_path = os.path.join(fixtures_path, 'community_radio_events.csv')
        cls.opera_path = os.path.join(fixtures_path, 'public_opera_performances.csv')

        cls.expected_radio_col_names = ['lat', 'lon', 'event_name', 'date']
        cls.expected_dog_col_names = ['lat', 'lon', 'hooded_figure_id', 'date']
Ejemplo n.º 4
0
    def test_db_migrate(self, capfd, tmpdir, conf,
                        sa_engine):  # TODO: needs validation
        db.drop_all(sa_engine)

        with working_directory(tmpdir):
            manage.init("./migrations", "")
            manage.migrate("")
            captured = capfd.readouterr()

        for line in captured.out.split("\n"):
            logger.info(line)
Ejemplo n.º 5
0
    def setUpClass(cls, shutdown=False):
        # Remove tables that we're about to recreate.
        # This doesn't happen in teardown because I find it helpful
        # to inspect them in the DB after running the tests.

        meta_table_names = ['meta_master', 'meta_shape', 'etl_task']
        drop_tables(meta_table_names)

        # Re-add meta tables
        init()

        cls.app = create_app().test_client()
Ejemplo n.º 6
0
    def setUpClass(cls):

        connection.execute('commit')
        try:
            connection.execute('drop database plenario_test')
        except ProgrammingError:
            pass
        connection.execute('commit')
        connection.execute('create database plenario_test')
        cls.engine = create_engine(postgres_uri + '/plenario_test')
        cls.session = sessionmaker(bind=cls.engine)()
        cls.connection = cls.engine.connect()
        cls.connection.execute('create extension postgis')

        postgres_base.metadata.create_all(bind=cls.engine)
        init()

        temperature = FeatureMeta(name="temperature", observed_properties=[{"type": "float", "name": "temperature"}])
        vector = FeatureMeta(name="vector", observed_properties=[{"type": "float", "name": "x"}, {"type": "float", "name": "y"}])
        tmp000 = SensorMeta(name="tmp000", observed_properties={"howhot": "temperature.temperature"})
        vec000 = SensorMeta(name="vec000", observed_properties={"vec_x": "vector.x", "vex_y": "vector.y"})
        node_a = NodeMeta(id="node_a", sensor_network="array_of_things__test", sensors=[tmp000, vec000], location="0101000020E6100000A4A7C821E2E755C07C48F8DEDFF04440")
        node_b = NodeMeta(id="node_b", sensor_network="array_of_things__test", sensors=[tmp000, vec000], location="0101000020E6100000A4A7C821E2E755C07C48F8DEDFF04440")
        node_c = NodeMeta(id="node_c", sensor_network="array_of_things__test", sensors=[tmp000, vec000], location="0101000020E6100000A4A7C821E2E755C07C48F8DEDFF04440")
        network = NetworkMeta(name="array_of_things_test", nodes=[node_a, node_b, node_c])

        for obj in [temperature, vector, tmp000, vec000, node_a, node_b, node_c, network]:
            cls.session.add(obj)
        cls.session.commit()

        fixtures = Fixtures()
        fixtures.rs_engine = cls.engine
        fixtures._create_foi_table({"name": "array_of_things_test__vector", "properties": [{"name": "x", "type": "float"}, {"name": "y", "type": "float"}]})
        fixtures._create_foi_table({"name": "array_of_things_test__temperature", "properties": [{"name": "temperature", "type": "float"}]})

        cls.app = create_app().test_client()
Ejemplo n.º 7
0
 def setUpClass(cls):
     uninstall()
     init()
     fixtures()
Ejemplo n.º 8
0
    def setUpClass(cls):

        connection.execute('commit')
        try:
            connection.execute('drop database plenario_test')
        except ProgrammingError:
            pass
        connection.execute('commit')
        connection.execute('create database plenario_test')
        cls.engine = create_engine(postgres_uri + '/plenario_test')
        cls.session = sessionmaker(bind=cls.engine)()
        cls.connection = cls.engine.connect()
        cls.connection.execute('create extension postgis')

        postgres_base.metadata.create_all(bind=cls.engine)
        init()

        temperature = FeatureMeta(name="temperature",
                                  observed_properties=[{
                                      "type": "float",
                                      "name": "temperature"
                                  }])
        vector = FeatureMeta(name="vector",
                             observed_properties=[{
                                 "type": "float",
                                 "name": "x"
                             }, {
                                 "type": "float",
                                 "name": "y"
                             }])
        tmp000 = SensorMeta(
            name="tmp000",
            observed_properties={"howhot": "temperature.temperature"})
        vec000 = SensorMeta(name="vec000",
                            observed_properties={
                                "vec_x": "vector.x",
                                "vex_y": "vector.y"
                            })
        node_a = NodeMeta(
            id="node_a",
            sensor_network="array_of_things__test",
            sensors=[tmp000, vec000],
            location="0101000020E6100000A4A7C821E2E755C07C48F8DEDFF04440")
        node_b = NodeMeta(
            id="node_b",
            sensor_network="array_of_things__test",
            sensors=[tmp000, vec000],
            location="0101000020E6100000A4A7C821E2E755C07C48F8DEDFF04440")
        node_c = NodeMeta(
            id="node_c",
            sensor_network="array_of_things__test",
            sensors=[tmp000, vec000],
            location="0101000020E6100000A4A7C821E2E755C07C48F8DEDFF04440")
        network = NetworkMeta(name="array_of_things_test",
                              nodes=[node_a, node_b, node_c])

        for obj in [
                temperature, vector, tmp000, vec000, node_a, node_b, node_c,
                network
        ]:
            cls.session.add(obj)
        cls.session.commit()

        fixtures = Fixtures()
        fixtures.rs_engine = cls.engine
        fixtures._create_foi_table({
            "name":
            "array_of_things_test__vector",
            "properties": [{
                "name": "x",
                "type": "float"
            }, {
                "name": "y",
                "type": "float"
            }]
        })
        fixtures._create_foi_table({
            "name":
            "array_of_things_test__temperature",
            "properties": [{
                "name": "temperature",
                "type": "float"
            }]
        })

        cls.app = create_app().test_client()