Code Monkey home page Code Monkey logo

greyteam2020 / gooutsafe_microservice Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 3.0 732 KB

:octocat: GoOutSafe a web app (with microservices architecture) that implements some cool features to survive during this covid19 Pandemic. This web app is developed during the Advanced Software Engineering course by the Univerisity of Pisa :computer:

Home Page: https://greyteam2020.github.io/GoOutSafe_microservice

Dockerfile 0.11% Python 76.58% JavaScript 1.59% CSS 0.52% HTML 21.15% Shell 0.04%
microservices-architecture python3 flask-application openapi3 university-project university-assignment

gooutsafe_microservice's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gooutsafe_microservice's Issues

User microservices crash

172.27.0.11 - - [23/Nov/2020:17:33:19 +0000] "GET /user/mark/email/[email protected] HTTP/1.1" 500 27074 "-" "python-requests/2.25.0" "-"
user_api_1           | Traceback (most recent call last):
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2464, in __call__
user_api_1           |     return self.wsgi_app(environ, start_response)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app
user_api_1           |     response = self.handle_exception(e)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception
user_api_1           |     reraise(exc_type, exc_value, tb)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
user_api_1           |     raise value
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
user_api_1           |     response = self.full_dispatch_request()
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
user_api_1           |     rv = self.handle_user_exception(e)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
user_api_1           |     reraise(exc_type, exc_value, tb)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
user_api_1           |     raise value
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
user_api_1           |     rv = self.dispatch_request()
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
user_api_1           |     return self.view_functions[rule.endpoint](**req.view_args)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/decorator.py", line 48, in wrapper
user_api_1           |     response = function(request)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/uri_parsing.py", line 144, in wrapper
user_api_1           |     response = function(request)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/validation.py", line 384, in wrapper
user_api_1           |     return function(request)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/parameter.py", line 121, in wrapper
user_api_1           |     return function(**kwargs)
user_api_1           |   File "/code/app.py", line 255, in mark_positive
user_api_1           |     result = UserService.mark_user_as_positive(db_session, user_email, user_phone)
user_api_1           |   File "/code/services/user_service.py", line 146, in mark_user_as_positive
user_api_1           |     new_positive.user_id = user.id
user_api_1           | AttributeError: 'NoneType' object has no attribute 'id'

Send Email migration

The sent email has the following exception

DEBUG    monolith.app:http_utils.py:37 Response is: []
DEBUG    monolith.app:http_utils.py:50 Url is: http://ngnix/send_email/send_contact
DEBUG    monolith.app:http_utils.py:51 Body request is: {'friends': [], 'contacts': [], 'past_restaurants': [], 'reservation_restaurants': []}
DEBUG    monolith.app:http_utils.py:54 Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '86', 'Content-Type': 'application/json'}
ERROR    monolith.app:http_utils.py:63 Error from microservice
ERROR    monolith.app:http_utils.py:64 Error received BAD REQUEST
ERROR    monolith.app:http_utils.py:65 Error content {'detail': "'user_positive' is a required property", 'status': 400, 'title': 'Bad Request', 'type': 'about:blank'}
DEBUG    monolith.app:restaurant_services.py:128 URL microservices: http://ngnix/restaurants

edit restaurant data bug

there's an error when a operator is logged in and click the restaurant data tab in the navbar

(Background on this error at: http://sqlalche.me/e/13/e3q8)

With the booking microservices, I have the following error with the db

gooutsafe_microservice_booking_api_1 exited with code 1
booking_api_1        | DEBUG:connexion.app:Root Path: /code
booking_api_1        | DEBUG:connexion.app:Specification directory: /code
booking_api_1        | DEBUG:connexion.app:Setting error handlers
booking_api_1        | Traceback (most recent call last):
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
booking_api_1        |     return fn()
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 364, in connect
booking_api_1        |     return _ConnectionFairy._checkout(self)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
booking_api_1        |     fairy = _ConnectionRecord.checkout(pool)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
booking_api_1        |     rec = pool._do_get()
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 241, in _do_get
booking_api_1        |     return self._create_connection()
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
booking_api_1        |     return _ConnectionRecord(self)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
booking_api_1        |     self.__connect(first_connect_check=True)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
booking_api_1        |     pool.logger.debug("Error on connect(): %s", e)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
booking_api_1        |     with_traceback=exc_tb,
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
booking_api_1        |     raise exception
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
booking_api_1        |     connection = pool._invoke_creator(self)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
booking_api_1        |     return dialect.connect(*cargs, **cparams)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 493, in connect
booking_api_1        |     return self.dbapi.connect(*cargs, **cparams)
booking_api_1        | sqlite3.OperationalError: unable to open database file
booking_api_1        | 
booking_api_1        | The above exception was the direct cause of the following exception:
booking_api_1        | 
booking_api_1        | Traceback (most recent call last):
booking_api_1        |   File "app.py", line 149, in <module>
booking_api_1        |     db_session = init_db("sqlite:///db/booking.db")
booking_api_1        |   File "/code/database.py", line 26, in init_db
booking_api_1        |     db.metadata.create_all(bind=engine)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/schema.py", line 4554, in create_all
booking_api_1        |     ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2094, in _run_visitor
booking_api_1        |     with self._optional_conn_ctx_manager(connection) as conn:
booking_api_1        |   File "/usr/local/lib/python3.7/contextlib.py", line 112, in __enter__
booking_api_1        |     return next(self.gen)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2086, in _optional_conn_ctx_manager
booking_api_1        |     with self._contextual_connect() as conn:
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2302, in _contextual_connect
booking_api_1        |     self._wrap_pool_connect(self.pool.connect, None),
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2340, in _wrap_pool_connect
booking_api_1        |     e, dialect, self
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1584, in _handle_dbapi_exception_noconnection
booking_api_1        |     sqlalchemy_exception, with_traceback=exc_info[2], from_=e
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
booking_api_1        |     raise exception
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
booking_api_1        |     return fn()
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 364, in connect
booking_api_1        |     return _ConnectionFairy._checkout(self)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
booking_api_1        |     fairy = _ConnectionRecord.checkout(pool)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
booking_api_1        |     rec = pool._do_get()
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 241, in _do_get
booking_api_1        |     return self._create_connection()
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
booking_api_1        |     return _ConnectionRecord(self)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
booking_api_1        |     self.__connect(first_connect_check=True)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
booking_api_1        |     pool.logger.debug("Error on connect(): %s", e)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
booking_api_1        |     with_traceback=exc_tb,
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
booking_api_1        |     raise exception
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
booking_api_1        |     connection = pool._invoke_creator(self)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
booking_api_1        |     return dialect.connect(*cargs, **cparams)
booking_api_1        |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 493, in connect
booking_api_1        |     return self.dbapi.connect(*cargs, **cparams)
booking_api_1        | sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
booking_api_1        | (Background on this error at: http://sqlalche.me/e/13/e3q8)

How customer when I will click on list reservation

When I click as a customer to see the list of reservation I receive the followed error:

TypeError: 'NoneType' object is not iterable

This is the docker logs

  | [2020-11-21 23:28:08,130] DEBUG in restaurant_services: URL microservices: http://ngnix/restaurants
gooutsafe_1          | [2020-11-21 23:28:08,131] DEBUG in http_utils: Url is: http://ngnix/restaurants
restaurants_api_2_1  | INFO:werkzeug:172.25.0.7 - - [21/Nov/2020 23:28:08] "GET /restaurants HTTP/1.0" 200 -
ngnix_1              | 172.25.0.12 - - [21/Nov/2020:23:28:08 +0000] "GET /restaurants HTTP/1.1" 200 702 "-" "python-requests/2.25.0" "-"
gooutsafe_1          | [2020-11-21 23:28:08,141] DEBUG in http_utils: Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
gooutsafe_1          | [2020-11-21 23:28:08,141] DEBUG in http_utils: Response is: {'restaurants': [{'avg_time': 30, 'covid_measures': 'Distance between tables 2mt; Menù touch; Alcohol Gel; Only Electronic Payment', 'id': 1, 'lat': 43.720586, 'lon': 10.408347, 'name': 'Trial Restaurant', 'owner_email': '[email protected]', 'phone': 555123456, 'rating': 2.6666666666666665}, {'avg_time': 30, 'covid_measures': 'Distance between tables 2mt; Menù touch; Alcohol Gel; Only Electronic Payment', 'id': 2, 'lat': 33.720586, 'lon': 11.408347, 'name': 'Pepperwood', 'owner_email': '[email protected]', 'phone': 555123427, 'rating': 0.0}]}
gooutsafe_1          | 172.25.0.1 - - [21/Nov/2020 23:28:08] "GET / HTTP/1.1" 200 -
celery_1             | [2020-11-21 23:28:09,702: DEBUG/Beat] beat: Synchronizing schedule...
celery_1             | [2020-11-21 23:28:09,716: INFO/Beat] Scheduler: Sending due task Rating (background.calculate_rating_for_all_celery)
celery_1             | [2020-11-21 23:28:09,724: DEBUG/Beat] background.calculate_rating_for_all_celery sent. id->332d4ab3-048b-490f-9794-1315b5dd5e19
celery_1             | [2020-11-21 23:28:09,725: DEBUG/Beat] beat: Waking up in 29.98 seconds.
celery_1             | [2020-11-21 23:28:09,732: INFO/MainProcess] Received task: background.calculate_rating_for_all_celery[332d4ab3-048b-490f-9794-1315b5dd5e19]  
celery_1             | [2020-11-21 23:28:09,733: DEBUG/MainProcess] TaskPool: Apply <function _trace_task_ret at 0x7f2a06e0b8c8> (args:('background.calculate_rating_for_all_celery', '332d4ab3-048b-490f-9794-1315b5dd5e19', {'lang': 'py', 'task': 'background.calculate_rating_for_all_celery', 'id': '332d4ab3-048b-490f-9794-1315b5dd5e19', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': '332d4ab3-048b-490f-9794-1315b5dd5e19', 'parent_id': None, 'argsrepr': '()', 'kwargsrepr': '{}', 'origin': 'gen12@aebce9f57a39', 'reply_to': 'e312ead9-a221-3ed7-ae15-36c1c99ddfd9', 'correlation_id': '332d4ab3-048b-490f-9794-1315b5dd5e19', 'hostname': 'celery@aebce9f57a39', 'delivery_info': {'exchange': '', 'routing_key': 'celery', 'priority': 0, 'redelivered': None}, 'args': [], 'kwargs': {}}, b'[[], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]', 'application/json', 'utf-8') kwargs:{})
celery_1             | [2020-11-21 23:28:09,748: DEBUG/ForkPoolWorker-2] Rating calculate for restaurant with name Trial Restaurant is 2.6666666666666665
celery_1             | [2020-11-21 23:28:09,749: DEBUG/MainProcess] Task accepted: background.calculate_rating_for_all_celery[332d4ab3-048b-490f-9794-1315b5dd5e19] pid:8
celery_1             | [2020-11-21 23:28:09,760: INFO/ForkPoolWorker-2] Task background.calculate_rating_for_all_celery[332d4ab3-048b-490f-9794-1315b5dd5e19] succeeded in 0.024259265999717172s: None
gooutsafe_1          | [2020-11-21 23:28:12,938] DEBUG in user_service: Filtering by: [None, None, 1]
gooutsafe_1          | [2020-11-21 23:28:12,939] DEBUG in http_utils: Url is: http://ngnix/book?user_id=1
ngnix_1              | 172.25.0.12 - - [21/Nov/2020:23:28:16 +0000] "GET /book?user_id=1 HTTP/1.1" 502 157 "-" "python-requests/2.25.0" "-"
ngnix_1              | 2020/11/21 23:28:16 [error] 27#27: *20 connect() failed (113: No route to host) while connecting to upstream, client: 172.25.0.12, server: , request: "GET /book?user_id=1 HTTP/1.1", upstream: "http://172.25.0.8:5004/book?user_id=1", host: "ngnix"
gooutsafe_1          | [2020-11-21 23:28:16,019] DEBUG in http_utils: Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
gooutsafe_1          | [2020-11-21 23:28:16,020] ERROR in http_utils: Error from microservice
gooutsafe_1          | [2020-11-21 23:28:16,021] ERROR in http_utils: Error received Bad Gateway
gooutsafe_1          | 172.25.0.1 - - [21/Nov/2020 23:28:16] "GET /customer/reservations HTTP/1.1" 500 -
gooutsafe_1          | Traceback (most recent call last):
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2464, in __call__
gooutsafe_1          |     return self.wsgi_app(environ, start_response)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app
gooutsafe_1          |     response = self.handle_exception(e)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception
gooutsafe_1          |     reraise(exc_type, exc_value, tb)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
gooutsafe_1          |     raise value
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
gooutsafe_1          |     response = self.full_dispatch_request()
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
gooutsafe_1          |     rv = self.handle_user_exception(e)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
gooutsafe_1          |     reraise(exc_type, exc_value, tb)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
gooutsafe_1          |     raise value
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
gooutsafe_1          |     rv = self.dispatch_request()
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
gooutsafe_1          |     return self.view_functions[rule.endpoint](**req.view_args)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask_login/utils.py", line 272, in decorated_view
gooutsafe_1          |     return func(*args, **kwargs)
gooutsafe_1          |   File "/code/monolith/auth.py", line 24, in f
gooutsafe_1          |     return func(*args, **kwargs)
gooutsafe_1          |   File "/code/monolith/views/users.py", line 140, in myreservation
gooutsafe_1          |     form=form,
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 140, in render_template
gooutsafe_1          |     ctx.app,
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/templating.py", line 120, in _render
gooutsafe_1          |     rv = template.render(context)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
gooutsafe_1          |     self.environment.handle_exception()
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
gooutsafe_1          |     reraise(*rewrite_traceback_stack(source=source))
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
gooutsafe_1          |     raise value.with_traceback(tb)
gooutsafe_1          |   File "/code/monolith/templates/user_reservations.html", line 18, in top-level template code
gooutsafe_1          |     {% for reservation in reservations_as_list %}
gooutsafe_1          | TypeError: 'NoneType' object is not iterable

raise JSONDecodeError("Expecting value", s, err.value) from None

During the booking faces, I have the following exception.

s: None
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:03:35] "POST /restaurant/book HTTP/1.1" 200 -
gooutsafe_1          | [2020-11-22 00:03:41,964] DEBUG in restaurant_services: URL microservices: http://ngnix/restaurants
gooutsafe_1          | [2020-11-22 00:03:41,966] DEBUG in http_utils: Url is: http://ngnix/restaurants
restaurants_api_1    | INFO:werkzeug:172.25.0.2 - - [22/Nov/2020 00:03:41] "GET /restaurants HTTP/1.0" 200 -
ngnix_1              | 172.25.0.12 - - [22/Nov/2020:00:03:41 +0000] "GET /restaurants HTTP/1.1" 200 702 "-" "python-requests/2.25.0" "-"
gooutsafe_1          | [2020-11-22 00:03:41,984] DEBUG in http_utils: Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
gooutsafe_1          | [2020-11-22 00:03:41,985] DEBUG in http_utils: Response is: {'restaurants': [{'avg_time': 30, 'covid_measures': 'Distance between tables 2mt; Menù touch; Alcohol Gel; Only Electronic Payment', 'id': 1, 'lat': 43.720586, 'lon': 10.408347, 'name': 'Trial Restaurant', 'owner_email': '[email protected]', 'phone': 555123456, 'rating': 2.6666666666666665}, {'avg_time': 30, 'covid_measures': 'Distance between tables 2mt; Menù touch; Alcohol Gel; Only Electronic Payment', 'id': 2, 'lat': 33.720586, 'lon': 11.408347, 'name': 'Pepperwood', 'owner_email': '[email protected]', 'phone': 555123427, 'rating': 0.0}]}
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:03:41] "GET / HTTP/1.1" 200 -
celery_1             | [2020-11-22 00:03:54,347: INFO/Beat] Scheduler: Sending due task Rating (background.calculate_rating_for_all_celery)
celery_1             | [2020-11-22 00:03:54,350: DEBUG/Beat] background.calculate_rating_for_all_celery sent. id->29349a8d-f271-4175-b9dc-570428bf9114
celery_1             | [2020-11-22 00:03:54,351: DEBUG/Beat] beat: Waking up in 29.99 seconds.
celery_1             | [2020-11-22 00:03:54,352: INFO/MainProcess] Received task: background.calculate_rating_for_all_celery[29349a8d-f271-4175-b9dc-570428bf9114]  
celery_1             | [2020-11-22 00:03:54,352: DEBUG/MainProcess] TaskPool: Apply <function _trace_task_ret at 0x7f8fb7a3c9d8> (args:('background.calculate_rating_for_all_celery', '29349a8d-f271-4175-b9dc-570428bf9114', {'lang': 'py', 'task': 'background.calculate_rating_for_all_celery', 'id': '29349a8d-f271-4175-b9dc-570428bf9114', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': '29349a8d-f271-4175-b9dc-570428bf9114', 'parent_id': None, 'argsrepr': '()', 'kwargsrepr': '{}', 'origin': 'gen12@510c7047a456', 'reply_to': 'be109ec3-119c-3ef4-8ec1-5fb77e612f54', 'correlation_id': '29349a8d-f271-4175-b9dc-570428bf9114', 'hostname': 'celery@510c7047a456', 'delivery_info': {'exchange': '', 'routing_key': 'celery', 'priority': 0, 'redelivered': None}, 'args': [], 'kwargs': {}}, b'[[], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]', 'application/json', 'utf-8') kwargs:{})
celery_1             | [2020-11-22 00:03:54,354: DEBUG/MainProcess] Task accepted: background.calculate_rating_for_all_celery[29349a8d-f271-4175-b9dc-570428bf9114] pid:8
celery_1             | [2020-11-22 00:03:54,359: DEBUG/ForkPoolWorker-2] Rating calculate for restaurant with name Trial Restaurant is 2.6666666666666665
celery_1             | [2020-11-22 00:03:54,370: INFO/ForkPoolWorker-2] Task background.calculate_rating_for_all_celery[29349a8d-f271-4175-b9dc-570428bf9114] succeeded in 0.016193370000110008s: None
gooutsafe_1          | [2020-11-22 00:04:02,781] DEBUG in http_utils: Url is: http://ngnix/book
gooutsafe_1          | [2020-11-22 00:04:02,781] DEBUG in http_utils: Body request is: {'restaurant_id': 2, 'user_id': 1, 'datetime': '2020-11-28T21:00:00Z', 'people_number': 2, 'raw_friends': '[email protected]'}
booking_api_1        | DEBUG:connexion.apis.flask_api:Getting data and status code
booking_api_1        | DEBUG:connexion.decorators.validation:http://booking_api:5004/book validating schema...
booking_api_1        | DEBUG:connexion.decorators.parameter:Function Arguments: ['private']
booking_api_1        | DEBUG:app:Request received: {'restaurant_id': 2, 'user_id': 1, 'datetime': '2020-11-28T21:00:00Z', 'people_number': 2, 'raw_friends': '[email protected]'}
booking_api_1        | DEBUG:app:Translated obj to vars
booking_api_1        | DEBUG:app:Friends: ['[email protected]']
booking_api_1        | DEBUG:app:Url is: http://ngnix/user/1
booking_api_1        | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): ngnix:80
ngnix_1              | 2020/11/22 00:04:02 [error] 27#27: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 172.25.0.5, server: , request: "GET /user/1 HTTP/1.1", upstream: "http://172.25.0.2:5002/user/1", host: "ngnix"
ngnix_1              | 2020/11/22 00:04:02 [warn] 27#27: *19 upstream server temporarily disabled while connecting to upstream, client: 172.25.0.5, server: , request: "GET /user/1 HTTP/1.1", upstream: "http://172.25.0.2:5002/user/1", host: "ngnix"
user_api_1           | DEBUG:connexion.apis.flask_api:Getting data and status code
user_api_1           | DEBUG:connexion.decorators.validation:http://user_api:5002/user/1 validating parameters...
user_api_1           | DEBUG:connexion.decorators.parameter:Function Arguments: ['id']
user_api_1           | DEBUG:connexion.apis.abstract:Getting data and status code
user_api_1           | DEBUG:connexion.apis.abstract:Prepared body and status code (404)
user_api_1           | DEBUG:connexion.apis.abstract:Got framework response
user_api_1           | INFO:werkzeug:172.25.0.2 - - [22/Nov/2020 00:04:02] "GET /user/1 HTTP/1.0" 404 -
ngnix_1              | 172.25.0.5 - - [22/Nov/2020:00:04:02 +0000] "GET /user/1 HTTP/1.1" 404 33 "-" "python-requests/2.25.0" "-"
booking_api_1        | DEBUG:urllib3.connectionpool:http://ngnix:80 "GET /user/1 HTTP/1.1" 404 33
booking_api_1        | DEBUG:app:Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
booking_api_1        | ERROR:app:Error from microservice
booking_api_1        | ERROR:app:Error received NOT FOUND
booking_api_1        | INFO:werkzeug:172.25.0.2 - - [22/Nov/2020 00:04:02] "POST /book HTTP/1.0" 500 -
ngnix_1              | 172.25.0.12 - - [22/Nov/2020:00:04:02 +0000] "POST /book HTTP/1.1" 500 27321 "-" "python-requests/2.25.0" "-"
gooutsafe_1          | [2020-11-22 00:04:02,856] DEBUG in http_utils: Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '125', 'Content-Type': 'application/json'}
gooutsafe_1          | [2020-11-22 00:04:02,856] ERROR in http_utils: Error from microservice
gooutsafe_1          | [2020-11-22 00:04:02,856] ERROR in http_utils: Error received INTERNAL SERVER ERROR
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:04:02] "POST /restaurant/book HTTP/1.1" 500 -
gooutsafe_1          | Traceback (most recent call last):
gooutsafe_1          |   File "/usr/local/lib/python3.7/json/decoder.py", line 353, in raw_decode
gooutsafe_1          |     obj, end = self.scan_once(s, idx)
gooutsafe_1          | StopIteration: 0
gooutsafe_1          | 
gooutsafe_1          | During handling of the above exception, another exception occurred:
gooutsafe_1          | 
gooutsafe_1          | Traceback (most recent call last):
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2464, in __call__
gooutsafe_1          |     return self.wsgi_app(environ, start_response)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app
gooutsafe_1          |     response = self.handle_exception(e)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception
gooutsafe_1          |     reraise(exc_type, exc_value, tb)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
gooutsafe_1          |     raise value
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
gooutsafe_1          |     response = self.full_dispatch_request()
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
gooutsafe_1          |     rv = self.handle_user_exception(e)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
gooutsafe_1          |     reraise(exc_type, exc_value, tb)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
gooutsafe_1          |     raise value
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
gooutsafe_1          |     rv = self.dispatch_request()
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
gooutsafe_1          |     return self.view_functions[rule.endpoint](**req.view_args)
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/flask_login/utils.py", line 272, in decorated_view
gooutsafe_1          |     return func(*args, **kwargs)
gooutsafe_1          |   File "/code/monolith/auth.py", line 24, in f
gooutsafe_1          |     return func(*args, **kwargs)
gooutsafe_1          |   File "/code/monolith/views/book.py", line 68, in index
gooutsafe_1          |     request.form.get("friends"),
gooutsafe_1          |   File "/code/monolith/services/booking_services.py", line 27, in book
gooutsafe_1          |     response, code = HttpUtils.make_post_request(BOOKING_MICROSERVICE_URL, json)
gooutsafe_1          |   File "/code/monolith/utils/http_utils.py", line 65, in make_post_request
gooutsafe_1          |     current_app.logger.error("Error content {}".format(response.json()))
gooutsafe_1          |   File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 900, in json
gooutsafe_1          |     return complexjson.loads(self.text, **kwargs)
gooutsafe_1          |   File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
gooutsafe_1          |     return _default_decoder.decode(s)
gooutsafe_1          |   File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
gooutsafe_1          |     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
gooutsafe_1          |   File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
gooutsafe_1          |     raise JSONDecodeError("Expecting value", s, err.value) from None
gooutsafe_1          | json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:04:02] "GET /restaurant/book?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:04:02] "GET /restaurant/book?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:04:02] "GET /restaurant/book?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:04:03] "GET /restaurant/book?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
gooutsafe_1          | 172.25.0.1 - - [22/Nov/2020 00:04:03] "GET /restaurant/book?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
celery_1             | [2020-11-22 00:04:24,366: INFO/Beat] Scheduler: Sending due task Rating (background.calculate_rating_for_all_celery)
celery_1             | [2020-11-22 00:04:24,368: DEBUG/Beat] background.calculate_rating_for_all_celery sent. id->fb2fa92f-e676-484f-9e39-6cc5405cef4c
celery_1             | [2020-11-22 00:04:24,368: DEBUG/Beat] beat: Waking up in 29.99 seconds.
celery_1             | [2020-11-22 00:04:24,369: INFO/MainProcess] Received task: background.calculate_rating_for_all_celery[fb2fa92f-e676-484f-9e39-6cc5405cef4c]  
celery_1             | [2020-11-22 00:04:24,370: DEBUG/MainProcess] TaskPool: Apply <function _trace_task_ret at 0x7f8fb7a3c9d8> (args:('background.calculate_rating_for_all_celery', 'fb2fa9

Create Operator fail

When I try to create a new operator, after the login I don't see the correct view.

P.S: Debug also the log in the user microservcies

Search contact with a positive fail

With the actual test on search contact with tests form we have some problem with the search contact function.

Can you help me to understand what happens?

Some logs

DEBUG    monolith.app:user_service.py:146 User found is: {'dateofbirth': '1985-12-12T00:00:00Z', 'email': '[email protected]', 'firstname': 'User_890447', 'id': 125, 'is_positive': True, 'lastname': 'user_890447', 'phone': '1234562344890447', 'role_id': 3}
DEBUG    monolith.app:http_utils.py:21 Url is: http://ngnix/user/positiveinfo/email/[email protected]
DEBUG    monolith.app:http_utils.py:24 Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
DEBUG    monolith.app:http_utils.py:37 Response is: {'from_date': '2020-11-24', 'id': 3, 'marked': True, 'user_id': 125}
DEBUG    monolith.app:http_utils.py:21 Url is: http://ngnix/book?fromDate=2020-11-24T00:00:00Z&toDate=2020-11-10T00:00:00Z&user_id=125
DEBUG    monolith.app:http_utils.py:24 Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
DEBUG    monolith.app:http_utils.py:37 Response is: []
DEBUG    monolith.app:http_utils.py:21 Url is: http://ngnix/book?fromDate=2020-11-24T00:00:00Z&toDate=2020-11-10T00:00:00Z
DEBUG    monolith.app:http_utils.py:24 Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
DEBUG    monolith.app:http_utils.py:37 Response is: []

User microservice crash

    | INFO:werkzeug:172.27.0.5 - - [23/Nov/2020 17:33:20] "POST /user/user_by_email HTTP/1.0" 500 -
ngnix_1              | 172.27.0.11 - - [23/Nov/2020:17:33:20 +0000] "POST /user/user_by_email HTTP/1.1" 500 46445 "-" "python-requests/2.25.0" "-"
user_api_1           | Traceback (most recent call last):
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2464, in __call__
user_api_1           |     return self.wsgi_app(environ, start_response)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app
user_api_1           |     response = self.handle_exception(e)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception
user_api_1           |     reraise(exc_type, exc_value, tb)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
user_api_1           |     raise value
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
user_api_1           |     response = self.full_dispatch_request()
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
user_api_1           |     rv = self.handle_user_exception(e)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
user_api_1           |     reraise(exc_type, exc_value, tb)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
user_api_1           |     raise value
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
user_api_1           |     rv = self.dispatch_request()
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
user_api_1           |     return self.view_functions[rule.endpoint](**req.view_args)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/decorator.py", line 49, in wrapper
user_api_1           |     return self.api.get_response(response, self.mimetype, request)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/apis/flask_api.py", line 136, in get_response
user_api_1           |     return cls._get_response(response, mimetype=mimetype, extra_context={"url": flask.request.url})
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/apis/abstract.py", line 277, in _get_response
user_api_1           |     framework_response = cls._response_from_handler(response, mimetype, extra_context)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/apis/abstract.py", line 317, in _response_from_handler
user_api_1           |     return cls._build_response(mimetype=mimetype, data=data, status_code=status_code, extra_context=extra_context)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/apis/flask_api.py", line 173, in _build_response
user_api_1           |     data, status_code, serialized_mimetype = cls._prepare_body_and_status_code(data=data, mimetype=mimetype, status_code=status_code, extra_context=extra_context)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/apis/abstract.py", line 403, in _prepare_body_and_status_code
user_api_1           |     body, mimetype = cls._serialize_data(data, mimetype)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/apis/flask_api.py", line 190, in _serialize_data
user_api_1           |     body = cls.jsonifier.dumps(data)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/jsonifier.py", line 44, in dumps
user_api_1           |     return self.json.dumps(data, **kwargs) + '\n'
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/json/__init__.py", line 211, in dumps
user_api_1           |     rv = _json.dumps(obj, **kwargs)
user_api_1           |   File "/usr/local/lib/python3.7/json/__init__.py", line 238, in dumps
user_api_1           |     **kw).encode(obj)
user_api_1           |   File "/usr/local/lib/python3.7/json/encoder.py", line 201, in encode
user_api_1           |     chunks = list(chunks)
user_api_1           |   File "/usr/local/lib/python3.7/json/encoder.py", line 431, in _iterencode
user_api_1           |     yield from _iterencode_dict(o, _current_indent_level)
user_api_1           |   File "/usr/local/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
user_api_1           |     yield from chunks
user_api_1           |   File "/usr/local/lib/python3.7/json/encoder.py", line 438, in _iterencode
user_api_1           |     o = _default(o)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/connexion/apps/flask_app.py", line 138, in default
user_api_1           |     return json.JSONEncoder.default(self, o)
user_api_1           |   File "/usr/local/lib/python3.7/site-packages/flask/json/__init__.py", line 100, in default
user_api_1           |     return _json.JSONEncoder.default(self, o)
user_api_1           |   File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
user_api_1           |     raise TypeError(f'Object of type {o.__class__.__name__} '
user_api_1           | TypeError: Object of type Positive is not JSON serializable

Test warning

With the following request

        book2 = BookingServices.book(
            restaurant.id,
            user,
            datetime.datetime(year=2120, month=11, day=25, hour=13),
            6,
            "[email protected];[email protected];[email protected];[email protected];[email protected]",
        )

I receive a null response and I had also the following debug

DEBUG    monolith.app:restaurant_services.py:80 N tables is: 1
DEBUG    monolith.app:restaurant_services.py:88 Week day is 0
DEBUG    monolith.app:restaurant_services.py:90 Close dinner 22:00:00
DEBUG    monolith.app:restaurant_services.py:92 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:94 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:96 Open dinner 19:00:00
DEBUG    monolith.app:restaurant_services.py:98 Open lunch 12:00:00
DEBUG    monolith.app:restaurant_services.py:88 Week day is 1
DEBUG    monolith.app:restaurant_services.py:90 Close dinner 22:00:00
DEBUG    monolith.app:restaurant_services.py:92 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:94 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:96 Open dinner 19:00:00
DEBUG    monolith.app:restaurant_services.py:98 Open lunch 12:00:00
DEBUG    monolith.app:restaurant_services.py:88 Week day is 2
DEBUG    monolith.app:restaurant_services.py:90 Close dinner 22:00:00
DEBUG    monolith.app:restaurant_services.py:92 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:94 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:96 Open dinner 19:00:00
DEBUG    monolith.app:restaurant_services.py:98 Open lunch 12:00:00
DEBUG    monolith.app:restaurant_services.py:88 Week day is 3
DEBUG    monolith.app:restaurant_services.py:90 Close dinner 22:00:00
DEBUG    monolith.app:restaurant_services.py:92 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:94 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:96 Open dinner 19:00:00
DEBUG    monolith.app:restaurant_services.py:98 Open lunch 12:00:00
DEBUG    monolith.app:restaurant_services.py:88 Week day is 4
DEBUG    monolith.app:restaurant_services.py:90 Close dinner 22:00:00
DEBUG    monolith.app:restaurant_services.py:92 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:94 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:96 Open dinner 19:00:00
DEBUG    monolith.app:restaurant_services.py:98 Open lunch 12:00:00
DEBUG    monolith.app:restaurant_services.py:88 Week day is 5
DEBUG    monolith.app:restaurant_services.py:90 Close dinner 22:00:00
DEBUG    monolith.app:restaurant_services.py:92 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:94 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:96 Open dinner 19:00:00
DEBUG    monolith.app:restaurant_services.py:98 Open lunch 12:00:00
DEBUG    monolith.app:restaurant_services.py:88 Week day is 6
DEBUG    monolith.app:restaurant_services.py:90 Close dinner 22:00:00
DEBUG    monolith.app:restaurant_services.py:92 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:94 Close lunch  15:00:00
DEBUG    monolith.app:restaurant_services.py:96 Open dinner 19:00:00
DEBUG    monolith.app:restaurant_services.py:98 Open lunch 12:00:00
DEBUG    monolith.app:restaurant_services.py:105 Opening day list 
[{'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 0}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 1}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 2}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 3}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 4}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 5}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 6}]
DEBUG    monolith.app:restaurant_services.py:109 cuisine_type list is 
['Italian food']
DEBUG    monolith.app:http_utils.py:50 Url is: http://ngnix/restaurants/create
DEBUG    monolith.app:http_utils.py:51 Body request is: {'restaurant': {'name': 'mock_rest7055', 'covid_measures': 'We can survive40614', 'owner_email': '[email protected]', 'phone': 12349648, 'lat': 183.0, 'lon': 134.0, 'rating': 0, 'avg_time': 30}, 'restaurant_tables': 1, 'opening': [{'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 0}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 1}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 2}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 3}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 4}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 5}, {'close_dinner': '22:00:00', 'close_lunch': '15:00:00', 'open_dinner': '19:00:00', 'open_lunch': '12:00:00', 'week_day': 6}], 'menu': ['Italian food']}
DEBUG    monolith.app:http_utils.py:54 Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '1134', 'Content-Type': 'application/json'}
DEBUG    monolith.app:http_utils.py:68 Response is: {'avg_time': 30, 'covid_measures': 'We can survive40614', 'id': 40, 'lat': 183.0, 'lon': 134.0, 'name': 'mock_rest7055', 'owner_email': '[email protected]', 'phone': 12349648, 'rating': 0.0}
DEBUG    monolith.app:http_utils.py:50 Url is: http://ngnix/book
DEBUG    monolith.app:http_utils.py:51 Body request is: {'restaurant_id': 40, 'user_id': 149, 'datetime': '2120-11-25T10:00:00Z', 'people_number': 4, 'raw_friends': '[email protected];[email protected];[email protected]'}
DEBUG    monolith.app:http_utils.py:54 Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '135', 'Content-Type': 'application/json'}
ERROR    monolith.app:http_utils.py:63 Error from microservice
ERROR    monolith.app:http_utils.py:64 Error received NOT FOUND
ERROR    monolith.app:http_utils.py:65 Error content {'code': 404, 'message': 'The restaurant is closed'}

Internal error on booking microservices

When I run the tests

=================================== FAILURES ===================================
__________ Test_RestaurantServices.test_reservation_local_ko_by_email __________

self = <test_restaurant_services.Test_RestaurantServices object at 0x7ffbbbc39f60>

    def test_reservation_local_ko_by_email(self):
        """
        This test cases, tru to test the logic inside the services to avoid
        stupid result
    
        http://localhost:5000/my_reservations?fromDate=2013-10-07&toDate=2014-10-07&[email protected]
        :return:
        """
        user = create_user_on_db(role_id=2)
        assert user is not None
    
        from_date = "2013-10-07"
        to_date = "2014-10-07"
    
        def_rest = RestaurantServices.get_all_restaurants()[0]
        assert def_rest is not None
        all_reservation = RestaurantServices.get_reservation_rest(def_rest["id"], from_date, to_date, user.email)
>       assert len(all_reservation) == 0
E       TypeError: object of type 'NoneType' has no len()

I receive this error

DEBUG    monolith.app:http_utils.py:21 Url is: http://ngnix/book?restaurant_id=1&fromDate=2013-10-07&toDate=2014-10-07&[email protected]
DEBUG    monolith.app:http_utils.py:24 Header Request: {'User-Agent': 'python-requests/2.25.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
ERROR    monolith.app:http_utils.py:33 Error from microservice
ERROR    monolith.app:http_utils.py:34 Error received INTERNAL SERVER ERROR

Some error during the healt servcies test

I have this error during the execution of the tests, any idea @MariagiovannaRotundo?

=================================== FAILURES ===================================
__________________ Test_HealthyServices.test_mark_positive_ok __________________

self = <test_healthy_services.Test_HealthyServices object at 0x7fb298b7db38>

    def test_mark_positive_ok(self):
        """
        It tests that a user is correctly marked as covid-19 positive by
        health authority
        """
        # an operator
        user = create_user_on_db()
        assert user is not None
        assert user.role_id is 3
        positive = positive_with_user_id(user.id)
        assert positive is None
>       message = HealthyServices.mark_positive(user.email, user.phone)

monolith/tests/test_healthy_services.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
monolith/services/healthy_services.py:63: in mark_positive
    contacts = HealthyServices.search_contacts_for_email(user_email, user_phone)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

user_email = '[email protected]', user_phone = '123456234432403'

    @staticmethod
    def search_contacts_for_email(user_email: str, user_phone: str):
    
        if user_email == "" and user_phone == "":
            return "Insert an email or a phone number"
    
        friends = []
        contacts = []
        past_restaurants = []
        future_restaurants = []
    
        if user_email != "":
            URL = USER_MICROSERVICE_URL + "/positiveinfo/email/" + str(user_email)
        else:
            URL = USER_MICROSERVICE_URL + "/positiveinfo/phone/" + str(user_phone)
    
        # check if the user exists
        # check if the user is positive (get also date of marking) (API)
        response = HttpUtils.make_get_request(URL)
        if response is None:
            return "Error, please try again"
    
        if response == "User not found":
            return "The customer is not registered"
        elif response == "Information not found":
            return "The user is not Covid-19 positive"
        elif response == "Bad Request":
            return "Error"
    
        # now we have the information about the positivity of the user in response
        date_marking = response["from_date"]
        user_id = response["user_id"]
    
        # start to check contacts
        # API: get all reservation of the customer between date_marking and date_marking -14
        URL = (
            BOOKING_MICROSERVICE_URL
            + "?user_id="
            + str(user_id)
            + "&fromDate="
            + str(date_marking)
            + "&toDate="
>           + str(date_marking - timedelta(days=14))
        )
E       TypeError: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'

monolith/services/healthy_services.py:324: TypeError
------------------------------ Captured log call -------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.