Add test for set profile image db method (#1656)

This commit is contained in:
Jonathan Zernik 2021-10-19 08:32:23 -05:00 committed by GitHub
parent 0fa9755dea
commit 1a4e46c439
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,6 +115,11 @@ def new_profile_name():
yield "new_fake_profile_name"
@pytest.fixture
def profile_image_bytes():
yield bytes.fromhex("deadbeef")
@pytest.fixture
def profile_with_custom_price_id(squeak_db, inserted_contact_profile_id, custom_price_msat):
squeak_db.set_profile_custom_price_msat(
@ -133,6 +138,15 @@ def profile_with_new_name_id(squeak_db, inserted_contact_profile_id, new_profile
yield inserted_contact_profile_id
@pytest.fixture
def profile_with_image_id(squeak_db, inserted_contact_profile_id, profile_image_bytes):
squeak_db.set_profile_image(
inserted_contact_profile_id,
profile_image_bytes,
)
yield inserted_contact_profile_id
@pytest.fixture
def deleted_profile_id(squeak_db, inserted_contact_profile_id):
squeak_db.delete_profile(
@ -400,6 +414,12 @@ def test_set_profile_name(squeak_db, profile_with_new_name_id, new_profile_name)
assert profile.profile_name == new_profile_name
def test_set_profile_image(squeak_db, profile_with_image_id, profile_image_bytes):
profile = squeak_db.get_profile(profile_with_image_id)
assert profile.profile_image == profile_image_bytes
def test_deleted_profile(squeak_db, deleted_profile_id):
profile = squeak_db.get_profile(deleted_profile_id)