def test_read_from_hdx(self, configuration, read): galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST1') assert galleryitem['id'] == '2f90d964-f980-4513-ad1b-5df6b2d044ff' assert galleryitem['title'] == 'MyGalleryItem1' galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST2') assert galleryitem is None galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST3') assert galleryitem is None
def test_read_from_hdx(self, configuration, read): galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST1') assert galleryitem['id'] == '2f90d964-f980-4513-ad1b-5df6b2d044ff' assert galleryitem['title'] == 'MyGalleryItem1' galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST2') assert galleryitem is None galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST3') assert galleryitem is None
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'
def test_delete_from_hdx(self, configuration, post_delete): galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST1') galleryitem.delete_from_hdx() del galleryitem['id'] with pytest.raises(HDXError): galleryitem.delete_from_hdx()
def test_delete_from_hdx(self, configuration, post_delete): galleryitem = GalleryItem.read_from_hdx(configuration, 'TEST1') galleryitem.delete_from_hdx() del galleryitem['id'] with pytest.raises(HDXError): galleryitem.delete_from_hdx()