You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@pytest.fixture(scope="class")defmake_block_page(request: _pytest.fixtures.FixtureRequest) ->None:
def_make_block_page(cls: TestCase, title: str) ->dict:
block=MockModel(mocktitle=title, category=MockModel())
returnMockModel(mock_name="BlockPage", title=title, block=block)
# Make the method available from TestCaserequest.cls.make_block_page=_make_block_page
I was hoping that passing mock_name="BlockPage" as parameter to MockModel would do the trick and the model would accept the mock as being an instance of itself, but it doesn't.
How would you go about fixing this issue?
The text was updated successfully, but these errors were encountered:
Hi. I'd like to test a model method, while mocking the data of a test instance.
Using django wagtail and pytest.
models.py
conftest.py
test_models.py
pytest traceback
I was hoping that passing
mock_name="BlockPage"
as parameter to MockModel would do the trick and the model would accept the mock as being an instance of itself, but it doesn't.How would you go about fixing this issue?
The text was updated successfully, but these errors were encountered: