Ejemplo n.º 1
0
    def setUpClass(cls):
        cls.db_gpkg_empty = get_copy_gpkg_conn('test_empty_ladm_gpkg')
        cls.db_gpkg_test = get_copy_gpkg_conn('test_export_data_qpkg')
        cls.app = AppInterface()

        res, code, msg = cls.db_gpkg_empty.test_connection()
        cls.assertTrue(res, msg)

        res, code, msg = cls.db_gpkg_test.test_connection()
        cls.assertTrue(res, msg)
Ejemplo n.º 2
0
    def setUpClass(cls):
        import_qgis_model_baker()
        cls.db_gpkg_empty = get_copy_gpkg_conn('test_empty_ladm_gpkg')
        cls.db_gpkg_test = get_copy_gpkg_conn('test_export_data_qpkg')
        cls.qgis_utils = QGISUtils()

        result_empty = cls.db_gpkg_empty.test_connection()
        result_test = cls.db_gpkg_test.test_connection()
        cls.assertTrue(result_empty[0],
                       'The test connection is not working for empty db')
        cls.assertTrue(result_test[0],
                       'The test connection is not working for test data db')
Ejemplo n.º 3
0
    def setUpClass(cls):
        # DB with single child model
        cls.db_gpkg = get_copy_gpkg_conn('test_ladm_survey_model_gpkg')
        res, code, msg = cls.db_gpkg.test_connection()
        cls.assertTrue(res, msg)

        # DB with multiple child models and domains
        cls.db_multi_gpkg = get_copy_gpkg_conn('test_ladm_multiple_child_domains_gpkg')
        res, code, msg = cls.db_multi_gpkg.test_connection()
        cls.assertTrue(res, msg)

        cls.app = AppInterface()
        cls.ladm_data = LADMData()
    def setUpClass(cls):
        import_processing()
        import_asistente_ladm_col() # Import plugin
        cls.db_gpkg = get_copy_gpkg_conn('test_ladm_col_queries_qpkg')

        # We can't use the restored database connection because the expression functions use the one in the plugin;
        # that's why we have to get the database connection and assign it to the plugin
        cls.plugin = utils.plugins["asistente_ladm_col"]  # Dict of active plugins
        cls.conn_manager = cls.plugin.conn_manager
        cls.conn_manager.set_db_connector_for_source(cls.db_gpkg)

        res, code, msg = cls.db_gpkg.test_connection()
        cls.assertTrue(res, msg)
        cls.assertIsNotNone(cls.db_gpkg.names.T_ID_F, 'Names is None')
        cls.ladm_queries = QGISLADMQuery()

        # Maybe custom expression functions are not register in processing module
        QgsExpression.registerFunction(get_domain_code_from_value)
        QgsExpression.registerFunction(get_domain_value_from_code)

        # Plots to be consulted are defined
        layers = {
            cls.db_gpkg.names.LC_PLOT_T: None
        }
        cls.plugin.app.core.get_layers(cls.db_gpkg, layers, load=True)
        cls.test_plot_t_ids = get_field_values_by_key_values(layers[cls.db_gpkg.names.LC_PLOT_T],
                                                             cls.db_gpkg.names.T_ILI_TID_F,
                                                             ['fc68c492-fad5-4a7b-98a3-6104e84a4ec4'],
                                                             cls.db_gpkg.names.T_ID_F)
Ejemplo n.º 5
0
    def setUpClass(cls):
        import_processing()
        import_asistente_ladm_col()  # Import plugin
        import_qgis_model_baker()
        cls.db_gpkg = get_copy_gpkg_conn('test_ladm_col_queries_qpkg')

        # We can't use the restored database connection because the expression functions use the one in the plugin;
        # that's why we have to get the database connection and assign it to the plugin
        cls.plugin = utils.plugins[
            "asistente_ladm_col"]  # Dict of active plugins
        cls.conn_manager = cls.plugin.conn_manager
        cls.conn_manager.set_db_connector_for_source(cls.db_gpkg)

        res, code, msg = cls.db_gpkg.test_connection()
        cls.assertTrue(res, msg)
        cls.assertIsNotNone(cls.db_gpkg.names.T_ID_F, 'Names is None')
        cls.ladm_queries = QGISLADMQuery()

        # Maybe custom expression functions are not register in processing module
        QgsExpression.registerFunction(get_domain_code_from_value)
        QgsExpression.registerFunction(get_domain_value_from_code)

        # Standardize query results: id's are removed because it depends on the database test data
        standardize_query_results(expected_result_ladm_basic_query)
        standardize_query_results(expected_result_ladm_economic_query)
        standardize_query_results(expected_result_ladm_legal_query)
        standardize_query_results(expected_result_ladm_physical_query)
        standardize_query_results(
            expected_result_ladm_property_record_card_query)
Ejemplo n.º 6
0
    def setUpClass(cls):
        import_qgis_model_baker()
        cls.db_gpkg = get_copy_gpkg_conn('test_ladm_survey_model_gpkg')
        res, code, msg = cls.db_gpkg.test_connection()
        cls.assertTrue(res, msg)

        cls.app = AppInterface()
        cls.ladm_data = LADMData()
Ejemplo n.º 7
0
    def setUpClass(cls):
        cls.app = AppInterface()
        cls.db_gpkg = get_copy_gpkg_conn('test_ladm_survey_model_gpkg')

        print("INFO: Restoring databases to be used")
        restore_schema('test_ladm_col')
        cls.db_pg = get_pg_conn('test_ladm_col')

        schema = 'test_ladm_col'
        reset_db_mssql(schema)
        restore_schema_mssql(schema)
        cls.db_mssql = get_mssql_conn(schema)