# Path: main.py
# def get_root_path():
#     """
# 
#     :rtype : object
#     """
#     import os
#     path = os.path.dirname(__file__)
#     path = path.replace('\\', '/')
#     path = path[0: path.rfind('/')]
#     return path


import unittest
from tests.unit_tests_rob import _domain_rob
from tests.unit_tests_rob._domain_rob import Zorgverlener
from tests.unit_tests_rob.global_test_suite import test_system_config, get_global_test_pipeline, execute_sql, init_db
from tests.unit_tests_rob._mappings_rob import init_source_to_sor_mappings, init_sor_to_dv_mappings
from main import get_root_path
        self.pipe.register_domain(_domain_rob)
        # hj: onderstaande regel toegevoegd. Bij elke initiatie dient mappings met lege lijst te beginnen
        self.pipe.mappings = []
        self.pipe.mappings.extend(init_source_to_sor_mappings())
        self.pipe.mappings.extend(init_sor_to_dv_mappings(self.pipe))

    def test01_pipeline_run(self):

        print("test_run1:\n")
        self.pipeline.run()

        test_row_count(self, 'sor_test_system.zorgverlener_hstage', 4)
        test_row_count(self, 'dv.zorgverlener_hub', 4)
        test_row_count(self, 'dv.zorgverlener_sat', 4)
        test_row_count(self, 'dv.zorgverlener_sat_personalia', 4)
        test_row_count(self, 'dv.zorgverlener_adres_link', 4)

    def test02_pipeline_rerun(self):
        print("test_run1_her:\n")
        self.pipeline.run()

        test_row_count(self, 'sor_test_system.zorgverlener_hstage', 4)
        test_row_count(self, 'dv.zorgverlener_hub', 4)
        test_row_count(self, 'dv.zorgverlener_sat', 4)
        test_row_count(self, 'dv.zorgverlener_sat_personalia', 4)
        test_row_count(self, 'dv.zorgverlener_adres_link', 4)

    def test03_dv_update(self):
        # return
        print("test_run2:\n")

# Path: main.py
# def get_root_path():
#     """
# 
#     :rtype : object
#     """
#     import os
#     path = os.path.dirname(__file__)
#     path = path.replace('\\', '/')
#     path = path[0: path.rfind('/')]
#     return path


# Path: tests/old/unit_tests_rob/test05r_process.py
import unittest
from tests.unit_tests_rob import _domain_rob
from tests.unit_tests_rob._domain_rob import Zorgverlener
from tests.unit_tests_rob.global_test_suite import test_system_config, get_global_test_pipeline, execute_sql, init_db
from tests.unit_tests_rob._mappings_rob import init_source_to_sor_mappings, init_sor_to_dv_mappings
from main import get_root_path

        self.pipe.register_domain(_domain_rob)
        # hj: onderstaande regel toegevoegd. Bij elke initiatie dient mappings met lege lijst te beginnen
        self.pipe.mappings = []
        self.pipe.mappings.extend(init_source_to_sor_mappings())
        self.pipe.mappings.extend(init_sor_to_dv_mappings(self.pipe))

    def test01_pipeline_run(self):

        print("test_run1:\n")
        self.pipeline.run()

        test_row_count(self, 'sor_test_system.zorgverlener_hstage', 4)
        test_row_count(self, 'dv.zorgverlener_hub', 4)
        test_row_count(self, 'dv.zorgverlener_sat', 4)
        test_row_count(self, 'dv.zorgverlener_sat_personalia', 4)
        test_row_count(self, 'dv.zorgverlener_adres_link', 4)

    def test02_pipeline_rerun(self):
        print("test_run1_her:\n")
        self.pipeline.run()

        test_row_count(self, 'sor_test_system.zorgverlener_hstage', 4)
        test_row_count(self, 'dv.zorgverlener_hub', 4)
        test_row_count(self, 'dv.zorgverlener_sat', 4)
        test_row_count(self, 'dv.zorgverlener_sat_personalia', 4)
        test_row_count(self, 'dv.zorgverlener_adres_link', 4)

    def test03_dv_update(self):
        # return
        print("test_run2:\n")

        self.pipe.mappings[0].file_name = get_root_path() + '/PYELT/tests/data/zorgverleners2_rob.csv'