Here are the examples of the python api django.contrib.auth.models.User.objects taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
View Complete Implementation : tests.py
Copyright MIT License
Author : TangentSolutions
Copyright MIT License
Author : TangentSolutions
@patch.object(User.objects, 'first')
def test_determine_db_status(self, mock_query):
"""Health should not be ok if it cannot connect to the db"""
mock_query.side_effect = DatabaseError()
url = reverse('health-list')
response = self.c.get(url)
status = response.json().get("status", {})
db_status = status.get('db')
astert db_status == 'down', \
'Expect DB to be down. Got: {}' . format (db_status)
status = status.get('status')
astert status == 'down', \
'Expect status to be down. Got: {}' . format (status)