def test_hack_send_hacked_message(database, mock_message): User.create_admin(1, 1, database) character_hash = User.create_user(2, 2, "Test user", database) User.update_db_value(character_hash, "hacker_level", 1, database) client = BankingClientFactory(database).create_client(mock_message) character_hash_2 = User.create_user(3, 3, "Test user 2", database) character_hash_4 = User.create_user(4, 4, "Test user 4", database) User.update_db_value(character_hash_4, "hacker_defence", 1, database) user2 = client.get_user_by_user_hash(character_hash_2) user4 = client.get_user_by_user_hash(character_hash_4) with pytest.raises(UserError): client.prepare_hacker_message("/h@ck_message 1234567890 OLOLO") chat_id, sent_message, show_hack = client.prepare_hacker_message( f'/h@ck_message {character_hash_2} OLOLO') assert sent_message == "OLOLO" assert chat_id == user2.chat_id assert not show_hack with pytest.raises(HackerError): client.hack_inspect_user(f'/h@ck_message 0000000000 OLOLO') chat_id, sent_message, show_hack = client.prepare_hacker_message( f'/h@ck_message {character_hash_4} OLOLO') assert sent_message == "OLOLO" assert chat_id == user4.chat_id assert show_hack
def test_hack_inspect_user(database, mock_message): User.create_admin(1, 1, database) character_hash = User.create_user(2, 2, "Test user", database) User.update_db_value(character_hash, "hacker_level", 1, database) client = BankingClientFactory(database).create_client(mock_message) character_hash_2 = User.create_user(3, 3, "Test user 2", database) character_hash_4 = User.create_user(4, 4, "Test user 4", database) User.update_db_value(character_hash_4, "hacker_defence", 1, database) user2 = client.get_user_by_user_hash(character_hash_2) user4 = client.get_user_by_user_hash(character_hash_4) with pytest.raises(UserError): client.hack_inspect_user("/hack 1234567890") resulting_data, chat_id, show_hack = client.hack_inspect_user( f'/hack {character_hash_2}') assert resulting_data == user2.hack_result assert chat_id == user2.chat_id assert not show_hack with pytest.raises(HackerError): client.hack_inspect_user(f'/hack 0000000000') resulting_data, chat_id, show_hack = client.hack_inspect_user( f'/hack {character_hash_4}') assert resulting_data == user4.hack_result assert chat_id == user4.chat_id assert show_hack