while performing a test case for my model named Device I found and error in my terminal the error is
======================================================================
FAIL: test_device (farm_management.test.test_models.TestDevice)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/admin123/igrow-api/app/farm_management/test/test_models.py", line 68, in test_device
self.assertEqual(self.device1.last_fetched_on, datetime.datetime.utcnow())
AssertionError: datetime.datetime(2022, 1, 12, 9, 35, 19, 280416, tzinfo=<UTC>) != datetime.datetime(2022, 1, 12, 9, 35, 19, 281136)
----------------------------------------------------------------------
Ran 2 tests in 0.903s
FAILED (failures=1)
Destroying test database for alias 'default'...
I think this means I made some mistake while importing the datetime and utc
test file codes are here
import datetime
from django.test import TestCase
from django.db.utils import IntegrityError
from farm_management.models import Farm, Device, BatchYield, Batch
class TestDevice(TestCase):
def setUp(self):
self.device1 = Device.objects.create(
id="C004825",
fetch_status="1",
last_fetched_on=datetime.datetime.utcnow(),
geolocation="28.48064,77.09301",
device_status="inactive",
is_active="1",
)
def test_device(self):
self.assertEqual(self.device1.id, "C004825")
self.assertEqual(self.device1.fetch_status, "1")
self.assertEqual(self.device1.last_fetched_on, datetime.datetime.utcnow())
self.assertEqual(self.device1.geolocation, "28.48064,77.09301")
self.assertEqual(self.device1.device_status, "inactive")
self.assertEqual(self.device1.is_active, "1")
I just don't that how can i get the matching output which shows in my terminal and