<repo_name>PhilipL1/project-2<file_sep>/service-1/requirements.txt
flask 
requests 
flask_sqlalchemy 
pymysql 
flask_testing 
pytest 
requests_mock
pytest-cov<file_sep>/service-3/tests/test_app.py
from flask import url_for 
from flask_testing import TestCase
import requests_mock 
from app import app
import re

class TestBase(TestCase):
    def create_app(self):
        return app

class TestHome(TestBase):
    def test_get_day(self):
        for _ in range(20):
            response = self.client.get(url_for('get_day'))
            day,year,month,date = re.findall("(\S+)\((\d{4})-(\d{2})-(\d{2})\)", response.data.decode())[0]
            self.assertIn(day, {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"})
            self.assertEqual(year, "2022")
            self.assertIn(month,{"06", "07"})
            self.assertIn(int(date), range(0, 31))


            


<file_sep>/venv/lib/python3.6/site-packages/pytest_cov/__init__.py
"""pytest-cov: avoid already-imported warning: PYTEST_DONT_REWRITE."""
__version__ = '2.12.0'
<file_sep>/service-3/app.py
from flask import Flask,request
import random
from os import getenv
import random 
import datetime 
import calendar

app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = getenv("DATABASE_URI")

@app.route('/get_day',methods=['GET'])
def get_day():
    start_date = datetime.date(2022, 6, 1)
    end_date = datetime.date(2022, 7, 1)

    time_between_dates = end_date - start_date
    days_between_dates = time_between_dates.days
    random_number_of_days = random.randrange(days_between_dates)
    random_date = start_date + datetime.timedelta(days=random_number_of_days)
    date = str(random_date)
    #print(date)
    day = datetime.datetime.strptime(date, '%Y-%m-%d').weekday()
    #print(day)
    answer_day = calendar.day_name[day]
    return_value =str(answer_day) + "("+str(date) + ")"
    return return_value

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000, debug=True)

<file_sep>/deploy.sh
#!/bin/bash
scp docker-compose.yaml swarm-manager:
ssh swarm-manager << EOF 
export DATABASE_URI=${DATABASE_URI}
docker stack deploy --compose-file docker-compose.yaml project
EOF
<file_sep>/service-4/tests/test_app.py
from flask import url_for 
from flask_testing import TestCase
import requests_mock 
from app import app
from unittest.mock import patch 

class TestBase(TestCase):
    def create_app(self):
        return app

class TestHome(TestBase):
    def test_get_fortune(self):
        response = self.client.post(url_for('get_fortune', day = "Friday(2022-06-03)", number = 20))
        self.assertEqual(response.data.decode(), "On Friday(2022-06-03) you will find nothing but peace & happiness")

<file_sep>/service-1/app.py
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy 
import requests 
from os import getenv
#from SQLAlchemy import desc


app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = getenv('DATABASE_URI')

db = SQLAlchemy(app)

class Fortunes(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    fortune = db.Column(db.String(1000), nullable=False)

@app.route('/')
@app.route("/home")
def home():
    number = requests.get('http://number_api:5000/get_number').json()['number']
    day = requests.get('http://day_api:5000/get_day')
    fortune = requests.post(f'http://fortune_api:5000/get_fortune/{day.text}/{number}')


    
    db.session.add(
        Fortunes(
            fortune = fortune.text
        )
    )
    db.session.commit()
    last_three_fortune = Fortunes.query.order_by(Fortunes.id.desc()).limit(3).all()

    return render_template("home.html", title="Home", number=number,\
    day=day.text, fortune=fortune.text, all_fortune = last_three_fortune)

    
if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000, debug=True)<file_sep>/jenkins/test.sh
#!/bin/bash

sudo apt update 
#sudo apt install chromium-chromedriver -y
#sudo apt install python3-venv

sudo apt install python3 python3-pip python3-venv -y 
python3 -m venv venv
pip3 install requirements.txt
export DB_URI
export SECRET_KEY

source venv/bin/activate
#install pip requirements 
pip3 install -r service-1/requirements.txt
#run pytest
python3 -m pytest service-1 --junitxml=junit/test-results.xml --cov=service-1 --cov-report=xml --cov-report=html --cov-report term-missing
python3 -m pytest service-2 --junitxml=junit/test-results.xml --cov=service-2 --cov-report=xml --cov-report=html --cov-report term-missing
python3 -m pytest service-3 --junitxml=junit/test-results.xml --cov=service-3 --cov-report=xml --cov-report=html --cov-report term-missing
python3 -m pytest service-4 --junitxml=junit/test-results.xml --cov=service-4 --cov-report=xml --cov-report=html --cov-report term-missing

#run app
#docker-compose up -d build
<file_sep>/venv/lib/python3.6/site-packages/requests_mock/mocker.pyi
# Stubs for requests_mock.mocker

from requests_mock.adapter import AnyMatcher
from requests import Response
from requests_mock.request import _RequestObjectProxy
from typing import Any, Callable, Dict, List, Optional, Pattern, Type, TypeVar, Union

DELETE: str
GET: str
HEAD: str
OPTIONS: str
PATCH: str
POST: str
PUT: str

class MockerCore:
    case_sensitive: bool = ...
    def __init__(self, **kwargs: Any) -> None: ...
    def start(self) -> None: ...
    def stop(self) -> None: ...
    def add_matcher(self, matcher: Any) -> None: ...
    @property
    def request_history(self) -> List[_RequestObjectProxy]: ...
    @property
    def last_request(self) -> Optional[_RequestObjectProxy]: ...
    @property
    def called(self) -> bool: ...
    @property
    def called_once(self) -> bool: ...
    @property
    def call_count(self) -> int: ...
    def register_uri(
      self,
      method: Union[str, AnyMatcher],
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def request(
      self,
      method: Union[str, AnyMatcher],
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def get(
      self,
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def head(
      self,
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def options(
      self,
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def post(
      self,
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def put(
      self,
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def patch(
      self,
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...
    def delete(
      self,
      url: Union[str, Pattern[str], AnyMatcher],
      response_list: Optional[List[Dict[str, Any]]] = ...,
      request_headers: Dict[str, str] = ...,
      complete_qs: bool = ...,
      status_code: int = ...,
      text: str = ...,
      headers: Optional[Dict[str, str]] = ...,
      additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
      **kwargs: Any) -> Response: ...

_T = TypeVar('_T')

class Mocker(MockerCore):
    TEST_PREFIX: str = ...
    def __init__(
      self,
      kw: str = ...,
      case_sensitive: bool = ...,
      adapter: Any = ...,
      real_http: bool = ...) -> None: ...
    def __enter__(self) -> Any: ...
    def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
    def __call__(self, obj: Any) -> Any: ...
    def copy(self) -> Mocker: ...
    def decorate_callable(self, func: Callable[..., _T]) -> Callable[..., _T]: ...
    def decorate_class(self, klass: Type[_T]) -> Type[_T]: ...
mock = Mocker
<file_sep>/service-2/app.py
from flask import Flask,request, jsonify
import random
from os import getenv
import random 


app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = getenv("DATABASE_URI")

# animal generator route here
@app.route('/get_number',methods=['GET'])
def get_number():
    result = {'number':random.randint(10, 20)}
    return jsonify(result)

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000, debug=True)<file_sep>/service-1/tests/test_app.py
from flask import url_for 
from flask_testing import TestCase
import requests_mock 
from app import app, db

class TestBase(TestCase):
    def create_app(self):
        app.config.update(
            SQLALCHEMY_DATABASE_URI="sqlite:///test.db"
        )
        return app

    def setUp(self):
        db.create_all()

    def tearDown(self):
        db.session.remove()
        db.drop_all()

        
class TestHome(TestBase):
    def test_home(self):
        with requests_mock.Mocker() as mocker: 
            mocker.get('http://number_api:5000/get_number', json = {'number': 19})
            mocker.get('http://day_api:5000/get_day', text = 'Friday(2022-06-03)')
            mocker.post('http://fortune_api:5000/get_fortune/Friday(2022-06-03)/19', text = 'On Friday(2022-06-03) you will becomone a millionaire, lucky you!!')
            response = self.client.get(url_for('home'))
            self.assertEqual(response.status_code, 200)
            self.assertIn(b'On Friday(2022-06-03) you will becomone a millionaire, lucky you!!', response.data)


<file_sep>/service-2/tests/test_app.py
from flask import url_for 
from flask_testing import TestCase
import requests_mock 
from app import app

class TestBase(TestCase):
    def create_app(self):
        return app

class TestHome(TestBase):
    def test_get_number(self):
        for _ in range(20):
            response = self.client.get(url_for('get_number'))
            self.assertIn(response.json['number'], range(10, 21))


<file_sep>/README.md

## Contents
* [Introduction](#introduction) 
  * [Objective](#objective)
  * [Proposal](#proposal)
  * [The 4 Services](#The-4-Services)
* [Architecture](#architecture)
  * [Risk Assessment](#Risk-Assessment)
  * [Project Management](#Project-Management)
  * [Test Analysis](#Analysis-of-Testing)
  * [Continuous Integration pipeline](#continuous-integration)
* [Infrastructure](#development)
  * [Jenkins](#Jenkins)
  * [Entity Diagram](#Entity-Diagram)
  * [Docker Swarm](#Interactions-Diagram)
* [Development](#development)
  * [Unit Testing](#Unit-Testing)
  * [Front-End Design](#Front-End)
* [Footer](#Footer)
* 
## Introduction

### Objective
The objective provided for this project is as follows:
> To create a service-orientated architecture for your application, this application must be composed of at least 4 services that work together.
<br/>

More specifically, these 4 services should comprise of 1 front-end wrapper service, 2 (or more) back-end services, and 1 other back-end service that relies on data from the previous 2 back-end services in some way.

For this to be achieved, the following is required:
* Kanban Board: Asana or an equivalent Kanban Board
* Version Control: Git - using the feature-branch model
* CI Server: Jenkins
* Configuration Management: Ansible
* Cloud server: GCP virtual machines
* Containerisation: Docker
* Orchestration Tool: Docker Swarm
* Reverse Proxy: NGINX
* Database Layer: MySQL

### Proposal

To meet all of the requirements and to ensure the MVP was produced in the time-frame provided. I first had to concure the important aspect of the project which were the infrastructure and implementation of my CI/CD. This meant a basic application that hit the MVP requirements was create in the first sprint. 

### Fortune Generator 
* Service 1 (front-end): displays the results of the following 3 services for the user to see, as well as a brief history of past results.
* Service 2: returns a random number for the fortune. 
* Service 3: a random date from a given range is formed. The day of that random date is then calculated. The date and day is then returned.
* Service 4: returns a fortune is generated based on the random number. The date and day that the fortune will take place will also be returned.

 ## The 4 Services
 The diagram below shows how the services interact with one another. 
 <br/>
 ![services](https://i.imgur.com/ho2SPg1.png)
 Summary
 * The front-end sends GET requests to API-1 and API-2
 * API-1 & API-2 sends their response to API-3 as a POST request 
 * API-3 returns the appropriate information to the front end as a POST request 
 * The front-end can send requests to the MySQL instance to INSERT the new entry and SELECT the old entries in order to display a history to the user as required.
 <br/>

# Architecture
## Risk Assessment
My detailed Risk Assessment can be seen below, outlining the major and minor risks associated with this project.
<br/>
Here is a screenshot of my risk assessment at the start of my project :
<br/>

![risk assessment image](https://i.imgur.com/RkGAg0G.png)
<br/><br/>
Below is a screenshot of additional risks that where added at the end of my project when the risks became clear :
<br/>

![risk assessment image2](https://i.imgur.com/knTGlbx.png)
<br/>

The full risk assessment for this project can be found [here](https://docs.google.com/spreadsheets/d/1mq4bsv15Pg1NkuiAYihON9s1pke3uN9twct9S83Fh0c/edit?usp=sharing). 
<br/>

## Project Management 
Trello was used to track the progress of the project (pictured below). You can find the link to this board [here](https://trello.com/b/4UYzCR2H). I used Trello board rather than other project management tools such as Jira because it is free to use and user friendly which helps with visualisation of the project so that task can be completed efficiently.  
<br/>

![trello board image 1](https://i.imgur.com/xRolMUn.png)
![trello board image 2](https://i.imgur.com/qeHTB02.png)
<br/>

## Analysis of Testing
Having a test driven approach is essential for any successful project. Since this project is using an CI/CD approach, it is key to plan out what areas of the application will need to be tested. Also, to implement a system to run automated tests. 
<br/>
To start this process, I first had to understand the scope of the testing for this project.
<br/>

![image of testing](https://i.imgur.com/FxDBNDQ.png)
<br/>
Based on this result and the Moscow priorisitation, it is clear that unit testing is the only essential form of testing required to produce the MVP. 
I then went on to plan the test that needed to be done, as well as pseudo-code for my own personal reference as a kick start before writing my code. This tables helped me keep track on what test needs to be implemented.
![image of testing 2](https://i.imgur.com/OX0APtR.png)
<br/>

[View the original documentation](https://docs.google.com/spreadsheets/d/1wvi8PupgVidEtxT-IOtfdUEc5q0HvxSPXRxG-yZY_QA/edit?usp=sharing)
<br/>

# Infrastructure 
Continuous deployment is implemented throughout my project in order to allow rapid and smooth development-to-deployment. The approach I have taken allows deploying new versions of the application with limited down-time.

## Jenkins
Whenever new content is pushed to the dev branch, Github will send a webhook to Jenkins which tells it to run the following pipeline:

**1.** Unit Test: Pytest

```
Test the functionality of individual routes 
```
<br/>

**2. & 3.** Build & Push: docker-compose
```
Jenkins' credentials system is used to handle logging into DockerHub, before the new images are  pushed to the repository specified.
```
<br/>

**4.** Configure: ansible
```
Ansible configures several things:

Installing dependencies (such as docker and docker-compose),
Setting up the swarm, and joining the swarm on all worker nodes,
Reloading NGINX with any changes to the nginx.conf file.
```
<br/>

**5** Deploy: docker swarm/stack
```
Jenkins copies the docker-compose.yaml file over to the manager node, SSH's onto it, and then runs docker stack deploy
```
<br/>

The commands used in Jenkins' pipeline can be seen in the[ Jenkinsfile](https://github.com/PhilipL1/project-2/blob/test/jenkins/Jenkinsfile)
<br/>

![pipeline image](https://i.imgur.com/qKtGg9A.png)

## Entity Diagram 

The project database only has one table which is shown below. Outlining the elements in a table means that the validation required for each element is outlined explicitly, and can be tested accordingly. The results of the fortune is stored in the SQL database available upon request. The front end application displays the end-user's last 3 Fortunes which are taken from the database.  
<br/>

![Entity Diagram image](https://i.imgur.com/4FlhZgg.png)

## Interactions Diagram
The diagram below shows the layout of the virtual machines as used in this project. This displays where the information is taken from as a user connects to the NGINX machine on port 80.
<br/>

![user interface image](https://i.imgur.com/KGv5xpO.png)
<br/>
Using an orchestration tool (ansible), Docker Swarm. software developers are able to create a network of virtual machines that are all able to be accessed by end-users to provide the same service. 
<br/>
Anonther layer has been added to the system in a form of an NGINX load-balancer which  up-streams the user to the VM with the least connections. By adding this layer, the efficiency of the application improves as well as security as end-users have another stage in the application.
<br/>

 ## Development
 ### Front-End 
 When navigating to port 80 (default http port) on the NGINX's IP, the steps the end user will be taking has been mentioned previously, using a these diagram to help visualise the structure [here](https://i.imgur.com/ho2SPg1.png) and [here](https://i.imgur.com/KGv5xpO.png). The relevant information is displayed using HTML (with jinja2) for layout and CSS for styling. 
 ![web application](https://i.imgur.com/Z41L2Y4.png)
 
 ### Unit Testing 
 Unit testing is used here by seperating the route functions and testing each function with various scenarios. Each function should return the expected response under each given scenario for the test to be successful. These tests are run automatically after every Git push using Jenkins. Jenkins prints out whether or not the tests were successsful.Each tests were ran individual using a bash for-loop.
 <br/>

 ![test 1](https://i.imgur.com/NOH1JTA.png)
 ![test 2](https://i.imgur.com/T0Jj64y.png)
 ![test 3](https://i.imgur.com/vAz7FUa.png)
 ![test 4](https://i.imgur.com/5bePqpg.png)
 <br/>

A coverage report is also displayed noting the percentage of the application that was tested. This information helps the developer understand how much of the code in the app has been successfully tested.
If any of the unit testing fails, the entire Jenkins build is marked as a fail. However, this project had a 100% coverage indicating efficiency as all the lines in  in each of my routes was fully tested and there were no unnecessary syntax in my code.
<br/>

The results also produces a junit.xml file which is used by the Jenkins Junit plug-in to produce advanced testing reports, further easing traceback for the developer.

## Footer
### Future Improvements
* Using Integration testing to test the app as a whole, by the selenium approach would be ideal.
* Add a background colour for each fortune so the application is more apealing to end-users
* add functionality that allows user to input data. 
### Author
<NAME>

### Acknowledgements
* [<NAME>](https://github.com/htr-volker)
* [<NAME>](https://github.com/OliverNichols)<file_sep>/venv/lib/python3.6/site-packages/requests_mock/__init__.pyi
# Stubs for requests_mock

from requests_mock.adapter import ANY as ANY, Adapter as Adapter
from requests_mock.exceptions import MockException as MockException, NoMockAddress as NoMockAddress
from requests_mock.mocker import DELETE as DELETE, GET as GET, HEAD as HEAD, Mocker as Mocker, MockerCore as MockerCore, OPTIONS as OPTIONS, PATCH as PATCH, POST as POST, PUT as PUT, mock as mock
from requests_mock.request import _RequestObjectProxy as _RequestObjectProxy
from requests_mock.response import CookieJar as CookieJar, create_response as create_response
<file_sep>/venv/lib/python3.6/site-packages/requests_mock/adapter.pyi
# Stubs for requests_mock.adapter

from requests.adapters import BaseAdapter
from requests_mock import _RequestObjectProxy
from typing import Any, Callable, Dict, List, NewType, Optional, Pattern, Union

AnyMatcher = NewType("AnyMatcher", object)

ANY: AnyMatcher = ...

class _RequestHistoryTracker:
    request_history: List[_RequestObjectProxy] = ...
    def __init__(self) -> None: ...
    @property
    def last_request(self) -> Optional[_RequestObjectProxy]: ...
    @property
    def called(self) -> bool: ...
    @property
    def called_once(self) -> bool: ...
    @property
    def call_count(self) -> int: ...

class _RunRealHTTP(Exception): ...

class _Matcher(_RequestHistoryTracker):
    def __init__(self, method: Any, url: Any, responses: Any, complete_qs: Any, request_headers: Any, additional_matcher: Any, real_http: Any, case_sensitive: Any) -> None: ...
    def __call__(self, request: Any) -> Any: ...

class Adapter(BaseAdapter, _RequestHistoryTracker):
    def __init__(self, case_sensitive: bool = ...) -> None: ...
    def register_uri(
        self,
        method: Union[str, AnyMatcher],
        url: Union[str, Pattern[str], AnyMatcher],
        response_list: Optional[List[Dict[str, Any]]] = ...,
        request_headers: Dict[str, str] = ...,
        complete_qs: bool = ...,
        status_code: int = ...,
        text: str = ...,
        headers: Optional[Dict[str, str]] = ...,
        additional_matcher: Optional[Callable[[_RequestObjectProxy], bool]] = ...,
        **kwargs: Any
    ) -> Any: ...
    def add_matcher(self, matcher: Any) -> None: ...
<file_sep>/venv/lib/python3.6/site-packages/requests_mock/exceptions.pyi
# Stubs for requests_mock.exceptions

from typing import Any

class MockException(Exception): ...

class NoMockAddress(MockException):
    request: Any = ...
    def __init__(self, request: Any) -> None: ...

class InvalidRequest(MockException): ...
<file_sep>/service-4/app.py
from flask import Flask,request
import random
from os import getenv
import random 
import datetime 
import calendar

app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = getenv("DATABASE_URI")

@app.route('/get_fortune/<day>/<int:number>', methods=['POST'])
def get_fortune(day, number):
    if number == 10:
        return f"On {day} you loose you're house and fiance, Sorry about that!"
    elif number <= 13 :
        return f"On {day}  you will win £300 from the lottery, that's it sorry!"
    elif number <= 16:
        return f"On {day} you will recieve unlimited food, Love dat!"
    elif number <= 19:
            return f"On {day} you will becomone a millionaire, lucky you!!"
    else :
        return f"On {day} you will find nothing but peace & happiness"


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000, debug=True)<file_sep>/venv/lib/python3.6/site-packages/requests_mock/response.pyi
# Stubs for requests_mock.response

import six
from requests.cookies import RequestsCookieJar
from typing import Any

class CookieJar(RequestsCookieJar):
    def set(self, name: Any, value: Any, **kwargs: Any) -> Any: ...

class _FakeConnection:
    def send(self, request: Any, **kwargs: Any) -> None: ...
    def close(self) -> None: ...

class _IOReader(six.BytesIO):
    def read(self, *args: Any, **kwargs: Any) -> Any: ...

def create_response(request: Any, **kwargs: Any) -> Any: ...

class _Context:
    headers: Any = ...
    status_code: Any = ...
    reason: Any = ...
    cookies: Any = ...
    def __init__(self, headers: Any, status_code: Any, reason: Any, cookies: Any) -> None: ...

class _MatcherResponse:
    def __init__(self, **kwargs: Any) -> None: ...
    def get_response(self, request: Any) -> Any: ...
