def setUpClass(cls):
        tool = PythonTool()
        parameters = tool.getParameterInfo()
        params = tool.processParameters(parameters=parameters)
        out_f = params["connection_folder"]
        out_n = params["edit_connection_name"]
        plat = params["platform"]
        inst = params["instance"]

        cls.weaver_attributes = params["table_attributes"]

        edit_version_name = params["edit_version_name"]
        sql_table = params["sql_table"]
        gdb_table = params["gdb_table"]
        gdb_table_name = params["gdb_table_name"]
        opt = params["opt"]

        cls.sde_file = params["gis_gdb"]
        manager = Manager(opt=opt, connection_folder=out_f, target_sde=cls.sde_file,
                          new_version=edit_version_name, new_connection=out_n, platform=plat, instance=inst)
        manager.clean_previous()
        cls.version_sde_file = manager.connect_version()

        result = Tool.compare_tables(sql_table=sql_table, gdb_table=gdb_table)

        cls.match_fields = result["match_fields"]
        cls.add_rows = result["add_rows"]
        cls.exist_rows = result["exist_rows"]
        cls.folio_ids = result["folioIds"]

        env.workspace = cls.version_sde_file
        cls.editor = da.Editor(cls.version_sde_file)
        cls.version_gdb_table = arcpy.ListTables("*{}*".format(gdb_table_name))[0]
    def setUpClass(cls):
        tool = PythonTool()
        parameters = tool.getParameterInfo()
        params = tool.processParameters(parameters=parameters)
        cls.params = params

        buildings_name = params["buildings_name"]
        out_f = params["connection_folder"]
        out_n = params["edit_connection_name"]
        plat = params["platform"]
        inst = params["instance"]
        opt = params["opt"]
        edit_version_name = params["edit_version_name"]

        #  out_folder, out_name, platform, instance, options

        cls.sde_file = params["gis_gdb"]
        # opt, out_folder, uid, platform, instance, target_sde, new_name, parent_version
        cls.manager = Manager(opt=opt, connection_folder=out_f, target_sde=cls.sde_file, new_version=edit_version_name,
                              new_connection=out_n, platform=plat, instance=inst)
        cls.manager.clean_previous()
        cls.version_sde = cls.manager.connect_version()
        env.workspace = cls.version_sde
        cls.versioned_buildings = tool.get_versioned_fc(env.workspace, buildings_name)
        cls.edit = da.Editor(cls.version_sde)
        cls.edit.startEditing()
 def setUpClass(cls):
     tool = PythonTool()
     parameters = tool.getParameterInfo()
     params = tool.processParameters(parameters=parameters)
     cls.out_f = params["connection_folder"]
     cls.out_n = params["edit_connection_name"]
     cls.plat = params["platform"]
     cls.inst = params["instance"]
     cls.opt = params["opt"]
     cls.sde_file = params["gis_gdb"]
     cls.edit_version_name = params["edit_version_name"]
     cls.params = params
class TestWeaverUpdate(TestCase):
    def setUp(self):
        self.tool = WeaverGDBUpdate()

    def tearDown(self):
        self.tool = None

    def test_processParameters(self):
        params = self.tool.getParameterInfo()
        final_params = self.tool.processParameters(params)
        self.assertEquals(17, len(final_params.keys()))

    def test_execute(self):
        params = self.tool.getParameterInfo()
        result = self.tool.execute(params, '#')
        self.assertTrue(result)