def test_insert_update_likely_users_get_likely_users(self):
     target_id_vk = test_target_user.get("id_vk")
     likely_id_vk = test_likely_user1.get('id_vk')
     likely_user_params = dict(test_likely_user1)
     likely_user_params.pop("id")
     likely_user_params.pop("id_vk")
     users_in_db = [insert_update_likely_users(self.connection_db, target_id_vk, likely_id_vk, **likely_user_params),
                    get_likely_users(self.connection_db, test_target_user.get("id_vk"),
                                     test_likely_user1.get("id_vk"))]
     for user_in_db in users_in_db:
         self.assertEqual(user_in_db[1], target_id_vk)
         self.assertEqual(user_in_db[2], likely_id_vk)
         self.assertEqual(user_in_db[3], likely_user_params.get('first_name'))
         self.assertEqual(user_in_db[4], likely_user_params.get('last_name'))
         self.assertEqual(user_in_db[5], likely_user_params.get('sex'))
         self.assertEqual(user_in_db[6], likely_user_params.get('city'))
         self.assertEqual(user_in_db[7], likely_user_params.get('age'))
         self.assertEqual(user_in_db[8], likely_user_params.get('activities'))
         self.assertEqual(user_in_db[9], likely_user_params.get('interests'))
         self.assertEqual(user_in_db[10], likely_user_params.get('movies'))
         self.assertEqual(user_in_db[11], likely_user_params.get('music'))
         self.assertEqual(user_in_db[12], likely_user_params.get('books'))
         self.assertEqual(user_in_db[13], likely_user_params.get('quotes'))
         self.assertEqual(user_in_db[14], likely_user_params.get('about'))
         self.assertEqual(user_in_db[15], likely_user_params.get('home_town'))
         self.assertEqual(user_in_db[16], likely_user_params.get('urls_photo'))
         self.assertEqual(user_in_db[17], likely_user_params.get('relation'))
         self.assertEqual(user_in_db[18], likely_user_params.get('common_friends'))
         self.assertEqual(user_in_db[19], likely_user_params.get('common_groups'))
         self.assertEqual(user_in_db[20], likely_user_params.get('points_auto'))
 def test_user_to_db_from_db(self):
     target_id_vk = test_target_user.get("id_vk")
     likely_id_vk = test_likely_user1.get('id_vk')
     likely_user_in = LikelyUser(likely_id_vk,**test_likely_user1)
     likely_user_in.user_to_db(self.connection_db, target_id_vk)
     likely_user_out = LikelyUser(0)
     likely_user_out.user_from_db(self.connection_db, target_id_vk, likely_id_vk)
     self.assertEqual(likely_user_in.user_vk_id, likely_user_out.user_vk_id)
     self.assertEqual(likely_user_in.first_name, likely_user_out.first_name)
     self.assertEqual(likely_user_in.last_name, likely_user_out.last_name)
     self.assertEqual(likely_user_in.sex, likely_user_out.sex)
     self.assertEqual(likely_user_in.city, likely_user_out.city)
     self.assertEqual(likely_user_in.age, likely_user_out.age)
     self.assertEqual(likely_user_in.activities, likely_user_out.activities)
     self.assertEqual(likely_user_in.interests, likely_user_out.interests)
     self.assertEqual(likely_user_in.movies, likely_user_out.movies)
     self.assertEqual(likely_user_in.music, likely_user_out.music)
     self.assertEqual(likely_user_in.books, likely_user_out.books)
     self.assertEqual(likely_user_in.quotes, likely_user_out.quotes)
     self.assertEqual(likely_user_in.about, likely_user_out.about)
     self.assertEqual(likely_user_in.urls_photo, likely_user_out.urls_photo)
     self.assertEqual(likely_user_in.relation, likely_user_out.relation)
     self.assertEqual(likely_user_in.common_friends, likely_user_out.common_friends)
     self.assertEqual(likely_user_in.common_groups, likely_user_out.common_groups)
     self.assertEqual(likely_user_in.points_auto, likely_user_out.points_auto)
 def test_spec_list(self):
     type_list = -1
     target_id_vk = test_target_user.get("id_vk")
     likely_id_vk = test_likely_user1.get("id_vk")
     for user_id in range(0, 10):
         test_likely_user1.update({"first_name": f"first name {user_id+1}", "last_name": f"last name {user_id+1}"})
         likely_user_in = LikelyUser(likely_id_vk+user_id, **test_likely_user1)
         likely_user_in.user_to_db(self.connection_db, target_id_vk, type_list)
     with patch("db_engine.input", return_value='n'):
         users_in_black = spec_list(self.connection_db, target_id_vk, [], type_list)
     self.assertEqual(len(users_in_black), 10)
 def test_calculate_points_auto(self):
     target_user = TargetUser(test_target_user.get('id_vk'), test_target_user.get('login'),
                              test_target_user.get('token'), **test_target_user)
     likely_user = LikelyUser(test_likely_user1.get('id_vk'), **test_likely_user1)
     likely_user.calculate_points_auto(target_user)
     self.assertGreater(likely_user.points_auto, 100)
 def test_likely_user(self):
     user_vk_id = test_likely_user1.get("id_vk")
     user_for_test = LikelyUser(user_vk_id,  **test_likely_user1)
     self.assertEqual(user_for_test.user_vk_id, user_vk_id)
     self.assertEqual(user_for_test.first_name, test_likely_user1.get("first_name"))
     self.assertEqual(user_for_test.last_name, test_likely_user1.get("last_name"))
     self.assertEqual(user_for_test.sex, test_likely_user1.get("sex"))
     self.assertEqual(user_for_test.city, test_likely_user1.get("city"))
     self.assertEqual(user_for_test.age, test_likely_user1.get("age"))
     self.assertEqual(user_for_test.activities, test_likely_user1.get("activities"))
     self.assertEqual(user_for_test.interests, test_likely_user1.get("interests"))
     self.assertEqual(user_for_test.movies, test_likely_user1.get("movies"))
     self.assertEqual(user_for_test.music, test_likely_user1.get("music"))
     self.assertEqual(user_for_test.quotes, test_likely_user1.get("quotes"))
     self.assertEqual(user_for_test.about, test_likely_user1.get("about"))
     self.assertEqual(user_for_test.home_town, test_likely_user1.get("home_town"))
     self.assertEqual(user_for_test.relation, test_likely_user1.get("relation"))
     self.assertEqual(user_for_test.common_friends, test_likely_user1.get("common_friends"))
     self.assertEqual(user_for_test.common_groups, test_likely_user1.get("common_groups"))
     self.assertEqual(user_for_test.points_auto, test_likely_user1.get("points_auto"))
     self.assertEqual(user_for_test.urls_photo, test_likely_user1.get("urls_photo"))