mercredi 10 février 2021

Problem with pytest. Queryset in my model

I have problem with pytest. In file tests.py I have got this code

@pytest.mark.django_db
def test_AddCompany(client):
    response = client.post('/add-company/', {'name': 'Test Company', 'description': 'test description', 'contact': 'testingmail@mail.pl', 'services': '', 'city': '', 'have_stationary': ''})
    assert Company.objects.filter(name='Test')

And I got this error

E        +  where <QuerySet []> = <bound method BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_method of <django.db.models.manager.Manager object at 0x000002ACF3AD6C70>>(name='Test')
E        +    where <bound method BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_method of <django.db.models.manager.Manager object at 0x000002ACF3AD6C70>> = <django.db.models.manager.Manager object at 0x0
00002ACF3AD6C70>.filter
E        +      where <django.db.models.manager.Manager object at 0x000002ACF3AD6C70> = Company.objects

services, city and have_stationary its foreign key.

Aucun commentaire:

Enregistrer un commentaire