Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import logging
|
||||
|
||||
import connexion
|
||||
from flask_testing import TestCase
|
||||
|
||||
from swagger_server.encoder import JSONEncoder
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
|
||||
def create_app(self):
|
||||
logging.getLogger('connexion.operation').setLevel('ERROR')
|
||||
app = connexion.App(__name__, specification_dir='../swagger/')
|
||||
app.app.json_encoder = JSONEncoder
|
||||
app.add_api('swagger.yaml')
|
||||
return app.app
|
||||
@@ -0,0 +1,45 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestDoc2textController(BaseTestCase):
|
||||
"""Doc2textController integration test stubs"""
|
||||
|
||||
def test_datoteka_v_besedilo_post(self):
|
||||
"""Test case for datoteka_v_besedilo_post
|
||||
|
||||
Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo
|
||||
"""
|
||||
data = dict(file='file_example')
|
||||
response = self.client.open(
|
||||
'/datotekaVBesedilo/',
|
||||
method='POST',
|
||||
data=data,
|
||||
content_type='multipart/form-data')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_text_ocr(self):
|
||||
"""Test case for get_text_ocr
|
||||
|
||||
Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo s pomočjo ocr razpoznavanja
|
||||
"""
|
||||
data = dict(file='file_example')
|
||||
response = self.client.open(
|
||||
'/datotekaVBesedilo/ocr',
|
||||
method='POST',
|
||||
data=data,
|
||||
content_type='multipart/form-data')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import unittest
|
||||
unittest.main()
|
||||
@@ -0,0 +1,33 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.izlusci_body import IzlusciBody # noqa: E501
|
||||
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestExtractController(BaseTestCase):
|
||||
"""ExtractController integration test stubs"""
|
||||
|
||||
def test_get_candidates(self):
|
||||
"""Test case for get_candidates
|
||||
|
||||
Izlusci terminološke kandidate iz seznama besedil v conllu obliki
|
||||
"""
|
||||
body = IzlusciBody()
|
||||
response = self.client.open(
|
||||
'/izlusci',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import unittest
|
||||
unittest.main()
|
||||
@@ -0,0 +1,31 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestMarktextController(BaseTestCase):
|
||||
"""MarktextController integration test stubs"""
|
||||
|
||||
def test_get_text(self):
|
||||
"""Test case for get_text
|
||||
|
||||
Označi besedilo s classlo/stanzo z uporabo slovenskih modelov ter vrne conll-u format
|
||||
"""
|
||||
body = 'body_example'
|
||||
response = self.client.open(
|
||||
'/oznaciBesedilo',
|
||||
method='POST',
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import unittest
|
||||
unittest.main()
|
||||
@@ -0,0 +1,137 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat # noqa: E501
|
||||
from swagger_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestOssController(BaseTestCase):
|
||||
"""OssController integration test stubs"""
|
||||
|
||||
def test_get_conllu(self):
|
||||
"""Test case for get_conllu
|
||||
|
||||
Vrne CoNNL-U po id-ju datoteke
|
||||
"""
|
||||
query_string = [('id', 789)]
|
||||
response = self.client.open(
|
||||
'/oss/conlluPoId',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_conllus(self):
|
||||
"""Test case for get_conllus
|
||||
|
||||
Vrne seznam CoNNL-U-jev glede na iskalne pogoje
|
||||
"""
|
||||
query_string = [('leta', 56),
|
||||
('vrste', 'vrste_example'),
|
||||
('kljucnebesede', 'kljucnebesede_example'),
|
||||
('cerifpodrocja', 56)]
|
||||
response = self.client.open(
|
||||
'/oss/conlluPoIskanju',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_extracted_words(self):
|
||||
"""Test case for get_extracted_words
|
||||
|
||||
Vrne terminloške kandidate glede na
|
||||
"""
|
||||
query_string = [('leta', 56),
|
||||
('vrste', 'vrste_example'),
|
||||
('kljucnebesede', 'kljucnebesede_example'),
|
||||
('cerifpodrocja', 56)]
|
||||
response = self.client.open(
|
||||
'/oss/izlusciPoIskanju',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_file(self):
|
||||
"""Test case for get_file
|
||||
|
||||
Vrne binarni zapis v originalnem formatu po id-ju datoteke
|
||||
"""
|
||||
query_string = [('id', 789)]
|
||||
response = self.client.open(
|
||||
'/oss/datotekaPoId',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_files(self):
|
||||
"""Test case for get_files
|
||||
|
||||
Vrne seznam binarnih zapisov v originalnem formatu glede na iskalne pogoje
|
||||
"""
|
||||
query_string = [('leta', 56),
|
||||
('vrste', 'vrste_example'),
|
||||
('kljucnebesede', 'kljucnebesede_example'),
|
||||
('cerifpodrocja', 56)]
|
||||
response = self.client.open(
|
||||
'/oss/datotekePoIskanju',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_number_texts(self):
|
||||
"""Test case for get_number_texts
|
||||
|
||||
Vrne število besedil glede na iskalne pogoje
|
||||
"""
|
||||
query_string = [('leta', 56),
|
||||
('vrste', 'vrste_example'),
|
||||
('kljucnebesede', 'kljucnebesede_example'),
|
||||
('cerifpodrocja', 56)]
|
||||
response = self.client.open(
|
||||
'/oss/steviloBesedilPoIskanju',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_get_texts(self):
|
||||
"""Test case for get_texts
|
||||
|
||||
Vrne seznam besedil glede na iskalne pogoje
|
||||
"""
|
||||
query_string = [('leta', 56),
|
||||
('vrste', 'vrste_example'),
|
||||
('kljucnebesede', 'kljucnebesede_example'),
|
||||
('cerifpodrocja', 56)]
|
||||
response = self.client.open(
|
||||
'/oss/besedilaPoIskanju',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_oss_besedilo_po_id_get(self):
|
||||
"""Test case for oss_besedilo_po_id_get
|
||||
|
||||
Vrne besedilo po id-ju datoteke
|
||||
"""
|
||||
query_string = [('id', 789)]
|
||||
response = self.client.open(
|
||||
'/oss/besediloPoId',
|
||||
method='GET',
|
||||
query_string=query_string)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import unittest
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user