def test_update_in_hdx(self, configuration, post_update):
        showcase = Showcase()
        showcase['id'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()
        showcase['title'] = 'LALA'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        showcase = Showcase.read_from_hdx(
            '05e392bf-04e0-4ca6-848c-4e87bba10746')
        assert showcase['id'] == '05e392bf-04e0-4ca6-848c-4e87bba10746'
        assert showcase['title'] == 'MyShowcase1'

        showcase['name'] = 'TEST1'
        showcase['notes'] = 'lalalala'
        showcase.update_in_hdx()
        assert showcase['name'] == 'TEST1'
        assert showcase['notes'] == 'lalalala'
        assert showcase['state'] == 'active'
        expected = copy.deepcopy(showcase_resultdict)
        expected['notes'] = 'lalalala'
        expected['name'] = 'TEST1'
        expected['tags'] = [{
            'name':
            'economics',
            'vocabulary_id':
            '4381925f-0ae9-44a3-b30d-cae35598757b'
        }, {
            'name':
            'health',
            'vocabulary_id':
            '4381925f-0ae9-44a3-b30d-cae35598757b'
        }]
        assert showcase.get_old_data_dict() == expected

        showcase['name'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        del showcase['name']
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        showcase_data = copy.deepcopy(TestShowcase.showcase_data)
        showcase_data['title'] = 'MyShowcase1'
        showcase_data['name'] = 'TEST1'
        showcase = Showcase(showcase_data)
        showcase.create_in_hdx()
        assert showcase['name'] == 'TEST1'
        assert showcase['notes'] == 'My Showcase'
        assert showcase['state'] == 'active'
Beispiel #2
0
    def test_update_in_hdx(self, configuration, post_update):
        showcase = Showcase()
        showcase['id'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()
        showcase['title'] = 'LALA'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        showcase = Showcase.read_from_hdx(
            '05e392bf-04e0-4ca6-848c-4e87bba10746')
        assert showcase['id'] == '05e392bf-04e0-4ca6-848c-4e87bba10746'
        assert showcase['title'] == 'MyShowcase1'

        showcase['name'] = 'TEST1'
        showcase['notes'] = 'lalalala'
        showcase.update_in_hdx()
        assert showcase['name'] == 'TEST1'
        assert showcase['notes'] == 'lalalala'
        expected = copy.deepcopy(showcase_resultdict)
        expected['notes'] = 'lalalala'
        expected['name'] = 'TEST1'
        assert showcase.get_old_data_dict() == expected

        showcase['name'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        del showcase['name']
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        showcase_data = copy.deepcopy(TestShowcase.showcase_data)
        showcase_data['title'] = 'MyShowcase1'
        showcase_data['name'] = 'TEST1'
        showcase = Showcase(showcase_data)
        showcase.create_in_hdx()
        assert showcase['name'] == 'TEST1'
        assert showcase['notes'] == 'My Showcase'
    def test_update_in_hdx(self, configuration, post_update):
        showcase = Showcase()
        showcase['id'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()
        showcase['title'] = 'LALA'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        showcase = Showcase.read_from_hdx('05e392bf-04e0-4ca6-848c-4e87bba10746')
        assert showcase['id'] == '05e392bf-04e0-4ca6-848c-4e87bba10746'
        assert showcase['title'] == 'MyShowcase1'

        showcase['name'] = 'TEST1'
        showcase['notes'] = 'lalalala'
        showcase.update_in_hdx()
        assert showcase['name'] == 'TEST1'
        assert showcase['notes'] == 'lalalala'
        expected = copy.deepcopy(showcase_resultdict)
        expected['notes'] = 'lalalala'
        expected['name'] = 'TEST1'
        assert showcase.get_old_data_dict() == expected

        showcase['name'] = 'NOTEXIST'
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        del showcase['name']
        with pytest.raises(HDXError):
            showcase.update_in_hdx()

        showcase_data = copy.deepcopy(TestShowcase.showcase_data)
        showcase_data['title'] = 'MyShowcase1'
        showcase_data['name'] = 'TEST1'
        showcase = Showcase(showcase_data)
        showcase.create_in_hdx()
        assert showcase['name'] == 'TEST1'
        assert showcase['notes'] == 'My Showcase'