예제 #1
0
def test_delete_contact(database, mock_message):
    character_hash = User.create_user(2, 2, "Test user", database)
    character_hash_2 = User.create_user(3, 3, "Test user 2", database)
    client = BankingClientFactory(database).create_client(mock_message)
    client.add_contact(f"/add_contact {character_hash_2} somebody")
    assert client.delete_contact(f"/delete_contact {character_hash_2}"
                                 ) == ADDRESS_RECORD_DELETION_MESSAGE
예제 #2
0
def test_add_contact(database, mock_message):
    character_hash = User.create_user(2, 2, "Test user", database)
    character_hash_2 = User.create_user(3, 3, "Test user 2", database)
    client = BankingClientFactory(database).create_client(mock_message)
    with pytest.raises(AddressRecordError):
        client.add_contact(f"/add_contact {character_hash} SELF")
    assert client.add_contact(
        f"/add_contact {character_hash_2} somebody") == ADDRESS_RECORD_ADDED
    with pytest.raises(AddressRecordError):
        client.add_contact(f"/add_contact {character_hash_2} somebody")
예제 #3
0
def test_inspect_contact_list(database, mock_message):
    character_hash = User.create_user(2, 2, "Test user", database)
    character_hash_2 = User.create_user(3, 3, "Test user 2", database)
    client = BankingClientFactory(database).create_client(mock_message)
    assert client.inspect_contact_list() == NO_ADDRESS_RECORDS
    assert client.inspect_contact_list(character_hash_2) == NO_ADDRESS_RECORDS
    client.add_contact(f"/add_contact {character_hash_2} somebody")
    client = BankingClientFactory(database).create_client(mock_message)
    client = BankingClientFactory(database).create_client(mock_message)
    assert client.inspect_contact_list() != NO_ADDRESS_RECORDS
    assert client.inspect_contact_list(character_hash_2) == NO_ADDRESS_RECORDS