From 72b13b7e987e01170e93b39d4159fb73c8fd8d42 Mon Sep 17 00:00:00 2001
From: Dmitry <b4tm4n@mail.ru>
Date: Wed, 22 Sep 2021 15:49:58 +0300
Subject: [PATCH] add test_api_publications_add

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

diff --git a/tests/test_pub1c-rest.py b/tests/test_pub1c-rest.py
index 587ab4d..9ce543c 100644
--- a/tests/test_pub1c-rest.py
+++ b/tests/test_pub1c-rest.py
@@ -124,3 +124,21 @@ def test_api_infobases_available(client):
     actual.sort()
     assert actual == expected
 
+
+def test_api_publications(client):
+    response = client.get('/api/v1/publications')
+    data = response.get_json()
+    assert data == []
+
+
+def test_api_publications_add(client):
+    endpoint = '/api/v1/publications'
+    # before add
+    response = client.get(endpoint)
+    data = response.get_json()
+    assert data == []
+    # add
+    response = client.put(path=endpoint, data={'name': 'test123'})
+    data = response.get_json()
+    assert data['message'] == 'created'
+    assert data['name'] == 'test123'