I have a Django application running in Docker and I am trying to implement unit tests using pytest but I am facing an issue when testing an endpoint that fires celery task, the test is not getting the response from the endpoint, I am hitting the endpoint using API client
The Issue
I have a Django application running in Docker and I am trying to implement unit tests using pytest but I am facing an issue when testing an endpoint that fires celery task, the test is not getting the response from the endpoint, I am hitting the endpoint using API client
The Code
The fixture
@pytest.fixture
def client():
return APIClient()
The Test Class and Function
@pytest.mark.django_db class TestSendfit: async def test_sendfit_post(self, client): sendfit_data = { "name": "Test Name", "age": 1000, "gender": "male", "email": "test@gmail.com", "country": "ZW", "preferences": ["hiit", "yoga"] } response = client.post(SENDFIT_URL, data=sendfit_data) assert response.status_code == status.HTTP_201_CREATED
I hope you can assist