From f311a5788ed74e56e102bf8d05e43731900fdcf3 Mon Sep 17 00:00:00 2001
From: Dmitry <b4tm4n@mail.ru>
Date: Wed, 22 Sep 2021 16:36:48 +0300
Subject: [PATCH] add test_api_publication_set_url

---
 tests/test_pub1c-rest.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/test_pub1c-rest.py b/tests/test_pub1c-rest.py
index bf547d6..412081f 100644
--- a/tests/test_pub1c-rest.py
+++ b/tests/test_pub1c-rest.py
@@ -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'
+