def test_that_can_read_and_write_hash_in_sample_log(self): # Arrange ws1 = self._provide_sample_workspace() tag1 = "test" value1 = "tested" value2 = "tested2" # Act + Assert self.assertFalse(has_hash(tag1, value1, ws1)) set_hash(tag1, value1, ws1) self.assertTrue(has_hash(tag1, value1, ws1)) self.assertFalse(has_hash(tag1, value2, ws1))
def test_that_can_read_and_write_hash_in_sample_log(self): # Arrange ws1 = self._provide_sample_workspace() tag1 = "test" value1 = "tested" value2 = "tested2" # Act + Assert hashed_value_1 = get_hash_value(value1) hashed_value_2 = get_hash_value(value2) self.assertFalse(has_hash(tag1, hashed_value_1, ws1)) set_hash(tag1, hashed_value_1, ws1) self.assertTrue(has_hash(tag1, hashed_value_1, ws1)) self.assertFalse(has_hash(tag1, hashed_value_2, ws1))
def does_can_workspace_exist_on_ads(can_workspace): """ Checks if a can workspace already exists on the ADS, based on the stored hash :param can_workspace: a handle to the can workspace :return: True if the workspace exists on the ADS else False """ if not has_tag(REDUCED_CAN_TAG, can_workspace): return False hash_value_to_compare = get_tag(REDUCED_CAN_TAG, can_workspace) for workspace in get_ads_workspace_references(): if has_hash(REDUCED_CAN_TAG, hash_value_to_compare, workspace): return True return False
def get_workspace_from_ads_based_on_hash(hash_value): for workspace in get_ads_workspace_references(): if has_hash(REDUCED_CAN_TAG, hash_value, workspace): return workspace