add test_api_publications_add_and_list

This commit is contained in:
Dmitry Belyaev 2021-09-22 16:07:43 +03:00
parent de454fe5c1
commit cb2de342c2
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3

View File

@ -1,3 +1,4 @@
import json
import os
from flask import Flask
@ -147,3 +148,24 @@ def test_api_publications_add(client):
assert response.status_code == 409
def test_api_publications_add_and_list(client):
endpoint = '/api/v1/publications'
# add publications
client.put(path=endpoint, data={'name': 'test123'})
client.put(path=endpoint, data={'name': 'test456', 'file': '/path/to/infobase'})
# get list
response = client.get(endpoint)
data = response.get_json()
assert len(data) == 2
# test123
assert data[0]['name'] == 'test123'
assert data[0]['publicated']
assert data[0]['url'] == '/1c/test123'
assert not data[0]['is_file_infobase']
# test456 / file
assert data[1]['name'] == 'test456'
assert data[1]['publicated']
assert data[1]['url'] == '/1c/test456'
assert data[1]['is_file_infobase']
assert data[1]['infobase_filepath'] == '/path/to/infobase'