예제 #1
0
 def test_user_profile_not_exists(self, mock_is_authenticated):
     mock_is_authenticated.return_value = True
     user_id = '1'
     UserDataModel.get_user_data_by_user_id = mock.MagicMock(side_effect=NoUserDataFoundException)
     ErrorHandler.create_error_response = mock.MagicMock(return_value=no_user_data_found_mock)
     service = ProfileController()
     ResponseBuilder.get_build_response = mock.MagicMock(return_value=profile_successful_mock)
     self.assertEqual(service.get(user_id), no_user_data_found_mock)
예제 #2
0
 def test_user_profile_db_conn_failed(self, mock_is_authenticated):
     mock_is_authenticated.return_value = True
     user_id = '1'
     UserDataModel.get_user_data_by_user_id = mock.MagicMock(side_effect=DBConnectionError(""))
     ErrorHandler.create_error_response = mock.MagicMock(return_value=no_db_conn_mock)
     service = ProfileController()
     ResponseBuilder.get_build_response = mock.MagicMock(return_value=profile_successful_mock)
     self.assertEqual(service.get(user_id), no_db_conn_mock)
예제 #3
0
 def test_user_profile_successful(self, mock_is_authenticated):
     mock_is_authenticated.return_value = True
     user_id = '1'
     UserDataModel.get_user_data_by_user_id = mock.MagicMock(return_value=user_data_successful_mock)
     storie = StorieDetailController()
     storie.get_stories_by_user_id = mock.MagicMock(return_value=stories_successful_mock)
     friend = FriendController()
     friend.get_friends_by_user_id = mock.MagicMock(return_value=friends_successful_mock)
     friend_request = BeFriendDetailController()
     friend_request.get_friends_requests_rcv_by_user_id = mock.MagicMock(return_value=rcv_requests_successful_mock)
     friend_request.get_friends_requests_sent_by_user_id = mock.MagicMock(return_value=sent_requests_successful_mock)
     service = ProfileController()
     ResponseBuilder.get_build_response = mock.MagicMock(return_value=profile_successful_mock)
     self.assertEqual(service.get(user_id), profile_successful_mock)
예제 #4
0
 def test_update_profile_user_mismatch(self, mock_is_authenticated, mock_get_user_id):
     mock_is_authenticated.return_value = True
     mock_get_user_id.return_value = 2
     ErrorHandler.create_error_response = mock.MagicMock(return_value=user_mismatch_mock)
     service = ProfileController()
     self.assertEqual(service.put(1), user_mismatch_mock)
예제 #5
0
파일: matcha.py 프로젝트: ssumodhe/Matcha
def profile_modifications():
    return ProfileController.profile_modifications(request.form)
예제 #6
0
파일: matcha.py 프로젝트: ssumodhe/Matcha
def profile(username):
    return ProfileController.profile(username)
예제 #7
0
파일: matcha.py 프로젝트: ssumodhe/Matcha
def profile_add_picture():
    return ProfileController.profile_add_picture(request.form, request.files)