add test_api_publication_set_url

This commit is contained in:
Dmitry Belyaev 2021-09-22 16:36:48 +03:00
parent 7d91b69e81
commit f311a5788e
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3

View File

@ -197,3 +197,19 @@ def test_api_publication_remove(client):
response = client.get('/api/v1/publications/test123')
assert response.status_code == 404
def test_api_publication_set_url(client):
# add publications
client.put(path='/api/v1/publications', data={'name': 'test123', 'url': 'some/url'})
# get
response = client.get('/api/v1/publications/test123/url')
data = response.get_json()
assert data['url'] == '/1c/some/url'
# set url
response = client.post(path='/api/v1/publications/test123/url', data={'url': '/another/url'})
assert response.status_code == 200
# get
response = client.get('/api/v1/publications/test123/url')
data = response.get_json()
assert data['url'] == '/1c/another/url'