Commit add0ca8e authored by Syed Bilal Raees's avatar Syed Bilal Raees

changes to test,hello and yaml

parent 1d69031b
Pipeline #2025 passed with stage
in 10 seconds
stages: stages:
- build - test
test_app: test_app:
image: python:3.6 image: python:3.6
stage: build stage: test
before_script: before_script:
- python3 -V - python3 -V
...@@ -12,9 +12,8 @@ test_app: ...@@ -12,9 +12,8 @@ test_app:
- python3 -m venv venv - python3 -m venv venv
- python3 -m venv python3-virtualenv - python3 -m venv python3-virtualenv
- source python3-virtualenv/bin/activate - source python3-virtualenv/bin/activate
- pwd
script: script:
- pip install Flask - pip install Flask
- python hello.py - python test.py
tags: tags:
- ci - ci
import flask #import flask
from flask import Flask, request
app = flask.Flask(__name__) #app = flask.Flask(__name__)
app.config["DEBUG"] = True #app.config["DEBUG"] = True
app = Flask(__name__)
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
def home(): def home():
return "<h1>HelloO DevOps people</h1><p>This site is a prototype API for greeting Nisum DevOps!</p>" return "<h1>HelloO DevOps people</h1><p>This site is a prototype API for greeting Nisum DevOps!</p>"
app.run(host='myApp.com', port=5000) #app.run(host='myApp.com', port=5000)
@app.route('/')
def calc():
a = int(request.args.get('a'))
b = int(request.args.get('b'))
return str(sum(a, b))
def sum(a, b):
return a + b
import unittest
from hello import sum
class Test(unittest.TestCase):
def test_sum(self):
value = sum(4, 5)
self.assertEqual(value, 9)
if __name__ == '__main__':
unittest.main()
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