Skip to content

Instantly share code, notes, and snippets.

@MuhanguziDavid
Last active September 18, 2018 12:49
Show Gist options
  • Save MuhanguziDavid/5b0b10f5b83ade05a41c446f22df7c13 to your computer and use it in GitHub Desktop.
Save MuhanguziDavid/5b0b10f5b83ade05a41c446f22df7c13 to your computer and use it in GitHub Desktop.
from authors.apps.authentication.models import User
from django.test import TestCase
from rest_framework import status
class LoginTest(TestCase):
def setUp(self):
self.user = User(email = "[email protected]", username = "davie", password = "12345678")
self.user.save()
def test_login_without_password(self):
response = self.client.post('users/login', data=dict(email="[email protected]", password = ""))
return self.assertIn("A password is required to log in.", str(response.data))
return self.assertEqual(request.status_code, status.HTTP_400_BAD_REQUEST)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment