From bffa816ef18b56aa58c13f17e4552888d158b29e Mon Sep 17 00:00:00 2001
From: Dmitry <b4tm4n@mail.ru>
Date: Thu, 23 Sep 2021 11:19:09 +0300
Subject: [PATCH] add test_api_infobases_all

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

diff --git a/tests/test_pub1c-rest.py b/tests/test_pub1c-rest.py
index 412081f..30fcde3 100644
--- a/tests/test_pub1c-rest.py
+++ b/tests/test_pub1c-rest.py
@@ -213,3 +213,24 @@ def test_api_publication_set_url(client):
     data = response.get_json()
     assert data['url'] == '/1c/another/url'
 
+
+def test_api_infobases_all(client):
+    # add publications
+    client.put(path='/api/v1/publications', data={'name': 'test1'})
+    # get list
+    response = client.get('/api/v1/infobases-all')
+    data = response.get_json()
+    assert len(data) == 3
+    # bpdemo
+    assert data[0]['name'] == 'bpdemo'
+    assert not data[0]['publicated']
+    assert data[0]['url'] == ''
+    # test1
+    assert data[1]['name'] == 'test1'
+    assert data[1]['publicated']
+    assert data[1]['url'] == '/1c/test1'
+    assert not data[1]['is_file_infobase']
+    # test2
+    assert data[2]['name'] == 'test2'
+    assert not data[2]['publicated']
+    assert data[2]['url'] == ''