test
This commit is contained in:
parent
1dc93c5f0d
commit
1f6260c976
@ -9,4 +9,4 @@ RUN bash setup_core.sh
|
|||||||
RUN pip3 install -r requirements.txt
|
RUN pip3 install -r requirements.txt
|
||||||
EXPOSE 5000/udp
|
EXPOSE 5000/udp
|
||||||
EXPOSE 5000/tcp
|
EXPOSE 5000/tcp
|
||||||
CMD ["python3", "ayct-backend/app.py"]
|
CMD ["python3 -m", "ayct-backend.app"]
|
@ -1,20 +0,0 @@
|
|||||||
from flask import Flask
|
|
||||||
from flask_restful import Api, Resource
|
|
||||||
import os
|
|
||||||
import pbrAyctCore.core as core
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
api = Api(app)
|
|
||||||
|
|
||||||
class Hello(Resource):
|
|
||||||
def get(self):
|
|
||||||
return core.getTestString()
|
|
||||||
|
|
||||||
api.add_resource(Hello, "/hello")
|
|
||||||
|
|
||||||
def create_app():
|
|
||||||
return app
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
port = int(os.environ.get('PORT', 5000))
|
|
||||||
app.run(host = '0.0.0.0', port = port)
|
|
11
ayct_backend/__init__.py
Normal file
11
ayct_backend/__init__.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from flask import Flask
|
||||||
|
import pbrAyctCore.core as core
|
||||||
|
|
||||||
|
def create_app():
|
||||||
|
app = Flask('ayct-backend')
|
||||||
|
|
||||||
|
@app.route('/hello')
|
||||||
|
def hello():
|
||||||
|
return core.getTestString()
|
||||||
|
|
||||||
|
return app
|
7
ayct_backend/app.py
Normal file
7
ayct_backend/app.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import os
|
||||||
|
from . import create_app
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = create_app()
|
||||||
|
port = int(os.environ.get('PORT', 5000))
|
||||||
|
app.run(host = '0.0.0.0', port = port)
|
@ -1,7 +0,0 @@
|
|||||||
[build-system]
|
|
||||||
requires = [
|
|
||||||
"setuptools>=42",
|
|
||||||
"wheel",
|
|
||||||
"flask"
|
|
||||||
]
|
|
||||||
build-backend = "setuptools.build_meta"
|
|
27
setup.cfg
27
setup.cfg
@ -1,24 +1,5 @@
|
|||||||
[metadata]
|
[bdist_wheel]
|
||||||
name = pbrAyctBackend
|
universal = True
|
||||||
version = 0.0.1
|
|
||||||
author = Łukasz Ramon Piotrek
|
|
||||||
author_email = ramon.dyzman@gmail.com
|
|
||||||
description = A small example package
|
|
||||||
long_description = file: readme.md
|
|
||||||
long_description_content_type = text/markdown
|
|
||||||
url = https://git.wmi.amu.edu.pl/s434708/pbr-ayct-backend
|
|
||||||
project_urls =
|
|
||||||
Bug Tracker = https://github.com/pypa/sampleproject/issues
|
|
||||||
classifiers =
|
|
||||||
Programming Language :: Python :: 3
|
|
||||||
License :: OSI Approved :: MIT License
|
|
||||||
Operating System :: OS Independent
|
|
||||||
|
|
||||||
[options]
|
[tool:pytest]
|
||||||
package_dir =
|
testpaths = tests
|
||||||
= ayct-backend
|
|
||||||
packages = find:
|
|
||||||
python_requires = >=3.6
|
|
||||||
|
|
||||||
[options.packages.find]
|
|
||||||
where = src
|
|
||||||
|
20
setup.py
Normal file
20
setup.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import io
|
||||||
|
|
||||||
|
from setuptools import find_packages
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="ayct_backend",
|
||||||
|
version="1.0.0",
|
||||||
|
url="https://git.wmi.amu.edu.pl/s434708/pbr-ayct-backend",
|
||||||
|
license="BSD",
|
||||||
|
maintainer="RŁP",
|
||||||
|
maintainer_email="random@mail.com",
|
||||||
|
description="Backend for AYCT",
|
||||||
|
packages=find_packages(),
|
||||||
|
include_package_data=True,
|
||||||
|
zip_safe=False,
|
||||||
|
install_requires=["flask"],
|
||||||
|
extras_require={"test": ["pytest"]},
|
||||||
|
)
|
@ -2,12 +2,12 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from ayct_backend import create_app
|
||||||
from app import create_app
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def client():
|
def client():
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
app.config['TESTING'] = True
|
||||||
app.run(host = '0.0.0.0', port = 5000)
|
app.run(host = '0.0.0.0', port = 5000)
|
||||||
|
|
||||||
with app.test_client() as client:
|
with app.test_client() as client:
|
Loading…
Reference in New Issue
Block a user