Commit bdbcc6db authored by IDSidorov's avatar IDSidorov
Browse files

Update .gitignore, .gitlab-ci.yml, app.py, dockerfile, requirements.txt,...

Update .gitignore, .gitlab-ci.yml, app.py, dockerfile, requirements.txt, tests/__init__.py, tests/base_case.py, tests/simple_test.py files
parents
Pipeline #3673 passed with stages
in 49 seconds
/venv
__pycache__
.vscode
image: python:latest
before_script:
- python3 -V
- pip3 install -r requirements.txt
- pip3 install flake8 pylint pytest
stages:
- Static Analysis
- Test
flake8:
stage: Static Analysis
allow_failure: true
script:
- flake8 *.py
pylint:
stage: Static Analysis
allow_failure: true
script:
- pylint *.py
unit_test:
stage: Test
script:
- python3 -m pytest
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, 704!'
if __name__ == '__main__':
app.debug = True
app.run()
FROM python:latest
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
import unittest
from app import app
class BaseCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
from tests.base_case import BaseCase
class SimpleTest(BaseCase):
def test_empty_app(self):
response = self.app.get('/')
self.assertEqual(200, response.status_code)
self.assertIn('Hello, 704!', response.data.decode('ascii'))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment