I'm new to Python. I'm trying to create a test that will create an item inside the admin panel, but when I run the test I get: AssertionError: False is not true. Help me please
class ItemAdminTest(TestCase):
serialized_rollback = True
def setUp(self):
self.client = Client()
self.user = User.objects.create_superuser(email='[email protected]', password='admin')
def test_create_item_admin(self):
self.client.login(email='[email protected]', password='admin')
response = self.client.post('/admin/product/item/add/', {
'title': 'Test Item',
'description': 'Test Description',
'price': 10.00,
'code': 123456,
'color': 'Red',
'weight': 1.5,
'height': 10.0,
'width': 5.5,
'types': ["КБТ", "МБТ"],
'amount': 5,
})
self.assertTrue(Item.objects.filter(title='Test Item').exists())
At the same time, I am absolutely sure that a superuser is created and authorization is successful, but for some reason the item itself is not created.