add test_api_publications_add_and_list
This commit is contained in:
parent
de454fe5c1
commit
cb2de342c2
@ -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'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user