Commit c1796251 authored by Vitali Stupin's avatar Vitali Stupin
Browse files

First test

parent eb0ad9fb
import unittest
import member
from flask import Flask, jsonify
class MemberTestCase(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
def test_make_response(self):
with self.app.app_context():
with self.assertLogs(member.logger, level='INFO') as cm:
response = member.make_response(
{'http_status': 200, 'code': 'OK', 'msg': 'All Correct'})
self.assertEqual(
jsonify({'code': 'OK', 'msg': 'All Correct'}).json,
response.json
)
self.assertEqual(200, response.status_code)
self.assertEqual(cm.output, [
"INFO:member:Response: {'http_status': 200, 'code': 'OK', "
+ "'msg': 'All Correct'}"])
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