예제 #1
0
    def test_tag_overwrite(self):
        metadata = MetaDataItem(title="title",
                                url="fake url 1",
                                download_src="youtube",
                                collision_type="car-v-car",
                                description="desc",
                                location="loc")

        simple_tag = {"hello": "world", "number": 1}
        metadata.add_tag("simple", simple_tag)

        self.assertEqual(metadata.tags,
                         {"simple": {
                             "hello": "world",
                             "number": 1
                         }})

        updated_value_tag = {"number": 2}
        metadata.add_tag("simple", updated_value_tag)

        self.assertEqual(metadata.tags,
                         {"simple": {
                             "hello": "world",
                             "number": 2
                         }})
예제 #2
0
    def test_fetch_metadata_with_tags(self):
        metadata = MetaDataItem(title="title",
                                url="fake url 1",
                                download_src="youtube")
        metadata.add_tag("hello", "world")

        try:
            self.storage.publish_new_metadata(metadata)

            fetched_metadata = self.storage.fetch_metadata(metadata.id)
            self.assertEqual(fetched_metadata.to_json(), metadata.to_json())

        finally:
            self.storage.delete_metadata(metadata.id)
        self.assertFalse(self.metadata_exists(metadata))