def testGetSiteId(self):
     """Test case -  translate data set id to site id."""
     try:
         cfds = ConfigInfoDataSet(self.__verbose, self.__lfh)
         for testId in self.__testIdList:
             siteId = cfds.getSiteId(depSetId=testId)
             logger.info(" testId %-12s siteId %20s", testId, siteId)
             self.assertEqual(siteId, self.__testIdLoc[testId])
     except Exception as e:  # pragma: no cover
         logger.exception("Update to get site id for dataset %s", str(e))
         self.fail()
    def testSetRemoveLocations(self):
        cidse = ConfigInfoDataSetExec()
        tset = ["D_800002", "D_800003"]
        status = cidse.setLocations("WWPDB_DEPLOY_DUMMY_RU", tset)
        self.assertTrue(status)

        # Check response
        cids = ConfigInfoDataSet()
        for d in tset:
            self.assertEqual(cids.getSiteId(d), "WWPDB_DEPLOY_DUMMY_RU")
        self.assertIsNone(cids.getSiteId("D_9999"))
        self.assertEqual(cids.getSiteId("D_1000200001"),
                         "WWPDB_DEPLOY_PRODUCTION_RU")

        # Removal
        status = cidse.removeDataSets([tset[0]])
        self.assertTrue(status)
        # Reinstantiate to load list again
        cids = ConfigInfoDataSet()
        self.assertEqual(cids.getSiteId(tset[0]), "UNASSIGNED",
                         "Removal failed")