Simplify profile fixtures for test db (#1655)

* Simplify and remove fixtures for profile tests in db test

* Delete old comments
This commit is contained in:
Jonathan Zernik 2021-10-19 08:16:15 -05:00 committed by GitHub
parent 93057f90b4
commit 0fa9755dea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,11 +68,6 @@ def inserted_signing_profile_id(squeak_db, signing_profile):
yield squeak_db.insert_profile(signing_profile)
# @pytest.fixture
# def inserted_signing_profile(squeak_db, inserted_signing_profile_id):
# yield squeak_db.get_profile(inserted_signing_profile_id)
@pytest.fixture
def inserted_contact_profile_id(squeak_db, contact_profile):
yield squeak_db.insert_profile(contact_profile)
@ -92,13 +87,6 @@ def followed_contact_profile_id(squeak_db, inserted_contact_profile_id):
yield inserted_contact_profile_id
@pytest.fixture
def followed_contact_profile(squeak_db, followed_contact_profile_id):
yield squeak_db.get_profile(
followed_contact_profile_id,
)
@pytest.fixture
def unfollowed_contact_profile_id(squeak_db, followed_contact_profile_id):
squeak_db.set_profile_following(
@ -108,13 +96,6 @@ def unfollowed_contact_profile_id(squeak_db, followed_contact_profile_id):
yield followed_contact_profile_id
@pytest.fixture
def unfollowed_contact_profile(squeak_db, unfollowed_contact_profile_id):
yield squeak_db.get_profile(
unfollowed_contact_profile_id,
)
@pytest.fixture
def profile_with_use_custom_price_id(squeak_db, inserted_contact_profile_id):
squeak_db.set_profile_use_custom_price(
@ -124,13 +105,6 @@ def profile_with_use_custom_price_id(squeak_db, inserted_contact_profile_id):
yield inserted_contact_profile_id
@pytest.fixture
def profile_with_use_custom_price(squeak_db, profile_with_use_custom_price_id):
yield squeak_db.get_profile(
profile_with_use_custom_price_id,
)
@pytest.fixture
def custom_price_msat():
yield 502379
@ -150,13 +124,6 @@ def profile_with_custom_price_id(squeak_db, inserted_contact_profile_id, custom_
yield inserted_contact_profile_id
@pytest.fixture
def profile_with_custom_price(squeak_db, profile_with_custom_price_id):
yield squeak_db.get_profile(
profile_with_custom_price_id,
)
@pytest.fixture
def profile_with_new_name_id(squeak_db, inserted_contact_profile_id, new_profile_name):
squeak_db.set_profile_name(
@ -166,13 +133,6 @@ def profile_with_new_name_id(squeak_db, inserted_contact_profile_id, new_profile
yield inserted_contact_profile_id
@pytest.fixture
def profile_with_new_name(squeak_db, profile_with_new_name_id):
yield squeak_db.get_profile(
profile_with_new_name_id,
)
@pytest.fixture
def deleted_profile_id(squeak_db, inserted_contact_profile_id):
squeak_db.delete_profile(
@ -195,7 +155,7 @@ def inserted_squeak_hashes(squeak_db, signing_key):
def followed_squeak_hashes(
squeak_db,
inserted_squeak_hashes,
followed_contact_profile,
followed_contact_profile_id,
):
yield inserted_squeak_hashes
@ -213,7 +173,7 @@ def authored_squeak_hashes(
def unfollowed_squeak_hashes(
squeak_db,
inserted_squeak_hashes,
unfollowed_contact_profile,
unfollowed_contact_profile_id,
):
yield inserted_squeak_hashes
@ -410,45 +370,34 @@ def test_get_timeline_squeak_entries_all_unfollowed(squeak_db, unfollowed_squeak
assert len(timeline_squeak_entries) == 0
# def test_get_signing_profile(squeak_db, signing_profile, inserted_signing_profile):
def test_set_profile_following(squeak_db, followed_contact_profile_id):
profile = squeak_db.get_profile(followed_contact_profile_id)
# assert inserted_signing_profile.profile_id is not None
# assert inserted_signing_profile.profile_name == signing_profile.profile_name
# assert inserted_signing_profile.private_key == signing_profile.private_key
# assert inserted_signing_profile.address == signing_profile.address
assert profile.following
# def test_get_contact_profile(squeak_db, contact_profile, inserted_contact_profile):
def test_set_profile_unfollowing(squeak_db, unfollowed_contact_profile_id):
profile = squeak_db.get_profile(unfollowed_contact_profile_id)
# assert inserted_contact_profile.profile_id is not None
# assert inserted_contact_profile.private_key is None
# assert inserted_contact_profile.profile_name == contact_profile.profile_name
# assert inserted_contact_profile.address == contact_profile.address
assert not profile.following
def test_set_profile_following(squeak_db, followed_contact_profile):
def test_set_profile_use_custom_price(squeak_db, profile_with_use_custom_price_id):
profile = squeak_db.get_profile(profile_with_use_custom_price_id)
assert followed_contact_profile.following
assert profile.use_custom_price
def test_set_profile_unfollowing(squeak_db, unfollowed_contact_profile):
def test_set_profile_custom_price(squeak_db, profile_with_custom_price_id, custom_price_msat):
profile = squeak_db.get_profile(profile_with_custom_price_id)
assert not unfollowed_contact_profile.following
assert profile.custom_price_msat == custom_price_msat
def test_set_profile_use_custom_price(squeak_db, profile_with_use_custom_price):
def test_set_profile_name(squeak_db, profile_with_new_name_id, new_profile_name):
profile = squeak_db.get_profile(profile_with_new_name_id)
assert profile_with_use_custom_price.use_custom_price
def test_set_profile_custom_price(squeak_db, profile_with_custom_price, custom_price_msat):
assert profile_with_custom_price.custom_price_msat == custom_price_msat
def test_set_profile_name(squeak_db, profile_with_new_name, new_profile_name):
assert profile_with_new_name.profile_name == new_profile_name
assert profile.profile_name == new_profile_name
def test_deleted_profile(squeak_db, deleted_profile_id):