Example #1
0
    def test_replaceExistingName_noDuplicate_originalNameUsed(self):
        meta_data = MetaData()
        meta_data.add_meta_data("Original", "Original")
        meta_data.add_meta_data("Original", "Original1")
        meta_data.add_meta_data("Original_X", "OriginalX")

        self.assertEqual(len((meta_data.meta_data())['Original']), 2, "Wrong number of elements in list")
        self.assertEqual((meta_data.meta_data())['Original_X'], "OriginalX", "Wrong name")
Example #2
0
    def test_validate_mappedTagsWithAttributes_metaDataHasTheRightContent(self):
        tags = {"test1": self.tag_not_empty_mapped,
                "test5": self.tag_empty_attribute}
        validator = MetaDataValidator(self.x, tags)
        validator.set_console_logger(self.c_logger)
        validator.set_file_logger(self.f_logger)

        meta = MetaData()
        validator.validate(meta)
        self.assertEqual(meta.is_valid(), True, "Invalid tags")
        if "test5_attr51" not in meta.meta_data() or "test5_attr52" not in meta.meta_data():
            raise Exception("Wrong attributes")
Example #3
0
 def test_replaceExistingName_twoDuplicatesInMap_AppendNumberThreeToTheName(self):
     meta_data = MetaData()
     meta_data.add_meta_data("Original", "Original")
     meta_data.add_meta_data("Original", "Original1")
     meta_data.add_meta_data("Original", "Original2")
     meta_data.add_meta_data("Original", "Original3")
     self.assertEqual(len((meta_data.meta_data())['Original']), 4, "Wrong number of elements in list")
Example #4
0
    def test_validate_optionalTag_doesntFailForInvalidTag(self):
        tags = {"test9": self.invalid_optional_tag}
        validator = MetaDataValidator(self.x, tags)
        validator.set_console_logger(self.c_logger)
        validator.set_file_logger(self.f_logger)

        meta = MetaData()
        validator.validate(meta)
        self.assertEqual(meta.is_valid(), True, "Invalid tags")
        if "optional_attr9" not in meta.meta_data():
            raise Exception("Wrong attributes")