Ejemplo n.º 1
0
 def post(self):
     """Endpoint for creating a single post"""
     time_start = time.time()
     return_data = PostServices.createNewPost(new_post_args.parse_args())
     time_end = time.time()
     monitor(time_start, time_end, path, "post")
     return return_data["data"], return_data["status"], {
         'message': return_data["message"]
     }
Ejemplo n.º 2
0
 def get(self):
     """Endpoint that gets all posts"""
     time_start = time.time()
     args = get_post_filter_args.parse_args()
     return_data = PostServices.getAllPosts(args)
     time_end = time.time()
     monitor(time_start, time_end, path, "get")
     return return_data["data"], return_data["status"], {
         'message': return_data["message"]
     }
Ejemplo n.º 3
0
 def get(self, user_id):
     """Endpoint that gets a all posts from user"""
     time_start = time.time()
     args = common_args.parse_args()
     args['userId'] = user_id
     return_data = PostServices.getPostByUser(args)
     time_end = time.time()
     monitor(time_start, time_end, path, "get")
     return return_data["data"], return_data["status"], {
         'message': return_data["message"]
     }
Ejemplo n.º 4
0
 def put(self, post_id):
     """Endpoint for updating a single post"""
     time_start = time.time()
     args = update_post_args.parse_args()
     args['postId'] = post_id
     return_data = PostServices.updatePost(args)
     time_end = time.time()
     monitor(time_start, time_end, path, "put")
     return return_data["data"], return_data["status"], {
         'message': return_data["message"]
     }
Ejemplo n.º 5
0
 def get(self, post_id):
     """Endpoint that gets a single post"""
     time_start = time.time()
     args = common_args.parse_args()
     args['postId'] = post_id
     return_data = PostServices.getPost(args)
     time_end = time.time()
     monitor(time_start, time_end, path, "get")
     return return_data["data"], return_data["status"], {
         'message': return_data["message"]
     }
Ejemplo n.º 6
0
 def test_new_post_id(self):
     response = PostServices.createNewPost(new_post)
     assert response["status"] == 201
     assert response["message"] == 'Post creado satisfactoriamente'
Ejemplo n.º 7
0
 def test_get_post_id(self):
     response = PostServices.getPost(registered_credentials_with_date)
     assert response["status"] == 200
     assert response["message"] == 'Post obtenidos satisfactoriamente'
Ejemplo n.º 8
0
 def test_get_all_posts(self):
     response = PostServices.getAllPosts(registered_credentials)
     assert response["status"] == 200
     assert response["message"] == 'Post obtenidos satisfactoriamente'