You've already forked hotpocket
BTHLABS-61: Service layer refactoring
A journey to fix `ValidationError` in Pocket imports turned service layer refactoring :D
This commit is contained in:
@@ -76,6 +76,18 @@ def starred_association_out(starred_association):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def deleted_save_association(association_factory, deleted_save):
|
||||
return association_factory(target=deleted_save)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def deleted_save_association_out(deleted_save_association):
|
||||
return AssociationWithTargetOut.model_validate(
|
||||
deleted_save_association, from_attributes=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def other_account_association(association_factory, other_account):
|
||||
return association_factory(account=other_account)
|
||||
@@ -124,6 +136,18 @@ def other_account_starred_association_out(other_account_starred_association):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def other_account_deleted_save_association(association_factory, other_account, deleted_save):
|
||||
return association_factory(account=other_account, target=deleted_save)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def other_account_deleted_save_association_out(other_account_deleted_save_association):
|
||||
return AssociationWithTargetOut.model_validate(
|
||||
other_account_deleted_save_association, from_attributes=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def browsable_associations(association,
|
||||
deleted_association,
|
||||
|
||||
@@ -64,11 +64,25 @@ def pocket_import_banned_netloc_save_spec():
|
||||
})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def pocket_import_invalid_url_spec():
|
||||
return PocketImportSaveSpec.model_validate({
|
||||
'title': "This isn't right",
|
||||
'url': 'thisisntright',
|
||||
'time_added': datetime.datetime(
|
||||
2021, 1, 18, 8, 0, 0, 0, tzinfo=datetime.UTC,
|
||||
),
|
||||
'tags': '',
|
||||
'status': 'unread',
|
||||
})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def pocket_csv_content(pocket_import_created_save_spec,
|
||||
pocket_import_reused_save_spec,
|
||||
pocket_import_other_account_save_spec,
|
||||
pocket_import_banned_netloc_save_spec,
|
||||
pocket_import_invalid_url_spec,
|
||||
):
|
||||
with io.StringIO() as csv_f:
|
||||
field_names = [
|
||||
@@ -82,6 +96,7 @@ def pocket_csv_content(pocket_import_created_save_spec,
|
||||
pocket_import_reused_save_spec.dict(),
|
||||
pocket_import_other_account_save_spec.dict(),
|
||||
pocket_import_banned_netloc_save_spec.dict(),
|
||||
pocket_import_invalid_url_spec.dict(),
|
||||
])
|
||||
|
||||
csv_f.seek(0)
|
||||
|
||||
Reference in New Issue
Block a user