From 1a4e46c43911e0f5e27fdff03fad37e245836d04 Mon Sep 17 00:00:00 2001 From: Jonathan Zernik Date: Tue, 19 Oct 2021 08:32:23 -0500 Subject: [PATCH] Add test for set profile image db method (#1656) --- tests/db/test_squeak_db.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/db/test_squeak_db.py b/tests/db/test_squeak_db.py index 5946ffba..64471776 100644 --- a/tests/db/test_squeak_db.py +++ b/tests/db/test_squeak_db.py @@ -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)