self = <test_main_views.TestCreateScrapeIntervalTaskView object at 0x0000012E0AA6A410>
client = <django.test.client.Client object at 0x0000012E0AE51BD0>
logged_in_user = <CustomUser: testuser>
valid_form_data = {'interval_value': 60, 'period': 'seconds'}
mocker = <pytest_mock.plugin.MockerFixture object at 0x0000012E0AE500D0>
def test_task_created(self, client: Client, logged_in_user: User, valid_form_data: dict, mocker):
mocker.patch("django.contrib.messages.error")
client.post(reverse("create_scrape_interval"), data=valid_form_data)
> assert (
PeriodicTask.objects.all().count() == 1
), f"Expected no periodic tasks to be created, but got {PeriodicTask.objects.all().count()}"
E AssertionError: Expected no periodic tasks to be created, but got 0
E assert 0 == 1
E + where 0 = <bound method QuerySet.count of <PeriodicTaskQuerySet []>>()
E + where <bound method QuerySet.count of <PeriodicTaskQuerySet []>> = <PeriodicTaskQuerySet []>.count
This probably has to do with us not actually mocking the POST request.
Also, task not being created leads to some other tests failing, e.g. test_interval_task_exists_in_session
Task is not being created Traceback:
This probably has to do with us not actually mocking the POST request. Also, task not being created leads to some other tests failing, e.g.
test_interval_task_exists_in_session