Esempio n. 1
0
    def test_update_in_hdx(self, configuration, post_update):
        galleryitem = GalleryItem(configuration)
        galleryitem['id'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()
        galleryitem['title'] = 'LALA'
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()

        galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST1')
        assert galleryitem['id'] == '2f90d964-f980-4513-ad1b-5df6b2d044ff'
        assert galleryitem['type'] == 'visualization'

        galleryitem['type'] = 'paper'
        galleryitem['id'] = 'TEST1'
        galleryitem['title'] = 'MyGalleryItem1'
        galleryitem.update_in_hdx()
        assert galleryitem['id'] == 'TEST1'
        assert galleryitem['type'] == 'paper'

        galleryitem['id'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()

        del galleryitem['id']
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()

        galleryitem_data = copy.deepcopy(TestGalleryItem.galleryitem_data)
        galleryitem_data['title'] = 'MyGalleryItem1'
        galleryitem_data['id'] = 'TEST1'
        galleryitem = GalleryItem(configuration, galleryitem_data)
        galleryitem.create_in_hdx()
        assert galleryitem['id'] == 'TEST1'
        assert galleryitem['type'] == 'visualization'
    def test_update_in_hdx(self, configuration, post_update):
        galleryitem = GalleryItem(configuration)
        galleryitem['id'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()
        galleryitem['title'] = 'LALA'
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()

        galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST1')
        assert galleryitem['id'] == '2f90d964-f980-4513-ad1b-5df6b2d044ff'
        assert galleryitem['type'] == 'visualization'

        galleryitem['type'] = 'paper'
        galleryitem['id'] = 'TEST1'
        galleryitem['title'] = 'MyGalleryItem1'
        galleryitem.update_in_hdx()
        assert galleryitem['id'] == 'TEST1'
        assert galleryitem['type'] == 'paper'

        galleryitem['id'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()

        del galleryitem['id']
        with pytest.raises(HDXError):
            galleryitem.update_in_hdx()

        galleryitem_data = copy.deepcopy(TestGalleryItem.galleryitem_data)
        galleryitem_data['title'] = 'MyGalleryItem1'
        galleryitem_data['id'] = 'TEST1'
        galleryitem = GalleryItem(configuration, galleryitem_data)
        galleryitem.create_in_hdx()
        assert galleryitem['id'] == 'TEST1'
        assert galleryitem['type'] == 'visualization'
Esempio n. 3
0
    def test_create_in_hdx(self, configuration, post_create):
        galleryitem = GalleryItem(configuration)
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()
        galleryitem['id'] = 'TEST1'
        galleryitem['title'] = 'LALA'
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()

        galleryitem_data = copy.deepcopy(TestGalleryItem.galleryitem_data)
        galleryitem = GalleryItem(configuration, galleryitem_data)
        galleryitem.create_in_hdx()
        assert galleryitem['id'] == '2f90d964-f980-4513-ad1b-5df6b2d044ff'

        galleryitem_data['title'] = 'MyGalleryItem2'
        galleryitem = GalleryItem(configuration, galleryitem_data)
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()

        galleryitem_data['title'] = 'MyGalleryItem3'
        galleryitem = GalleryItem(configuration, galleryitem_data)
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()
    def test_create_in_hdx(self, configuration, post_create):
        galleryitem = GalleryItem(configuration)
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()
        galleryitem['id'] = 'TEST1'
        galleryitem['title'] = 'LALA'
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()

        galleryitem_data = copy.deepcopy(TestGalleryItem.galleryitem_data)
        galleryitem = GalleryItem(configuration, galleryitem_data)
        galleryitem.create_in_hdx()
        assert galleryitem['id'] == '2f90d964-f980-4513-ad1b-5df6b2d044ff'

        galleryitem_data['title'] = 'MyGalleryItem2'
        galleryitem = GalleryItem(configuration, galleryitem_data)
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()

        galleryitem_data['title'] = 'MyGalleryItem3'
        galleryitem = GalleryItem(configuration, galleryitem_data)
        with pytest.raises(HDXError):
            galleryitem.create_in_hdx()