old_contents: from django.test import TestCase, RequestFactory
  
  from django.contrib.auth import get_user_model
  User = get_user_model()
  
  from django.test import Client
  
  from ..views import LoginView, SignupView, LogoutView, MQTTLoginView, MQTTSuperuserView, MQTTAclView
  
  class CreateUser(TestCase):
  
      def setUp(self):
  
          # Every test needs access to the request factory.
          self.factory = RequestFactory()
          self.user = User.objects.create_user(
              username='testuser1',
              email='test@user.com',
              password='top_secret')
  
      def test_login(self):
  
          # Create an instance of a GET request.
          request = self.factory.get('/aauth/login')
  
          #request.user = self.user
          #request.user = AnonymousUser()
  
          response = LoginView.as_view()(request)
          
          self.assertEqual(response.status_code, 200)
  
new_contents: from django.test import TestCase, RequestFactory
  
  from django.contrib.auth import get_user_model
  User = get_user_model()
  
  from django.test import Client
  
  from ..views import LoginView, SignupView, LogoutView, MQTTLoginView, MQTTSuperuserView, MQTTAclView
  
  class CreateUser(TestCase):
  
      def setUp(self):
  
          # Every test needs access to the request factory.
          self.factory = RequestFactory()
          self.user = User.objects.create_user(
              username='testuser1',
              email='test@user.com',
              password='top_secret')
  
      def test_login(self):
  
          # instantiate client
          client = Client()
  
          # blank login
          response = client.get('/aauth/login')
          self.assertEqual(response.status_code, 200)
  
          # correct login
          response = client.post('/aauth/login', { 'username': 'testuser1',
                                                   'password': 'top_secret' })
          self.assertEqual(response.status_code, 200)
  
          # incorrect username
          response = client.post('/aauth/login', { 'username': 'testuser11',
                                                   'password': 'top_secret' })
          self.assertEqual(response.status_code, 200)
  
          # incorrect password
          response = client.post('/aauth/login', { 'username': 'testuser1',
                                                   'password': 'top_secret0' })
          self.assertEqual(response.status_code, 200)
          
  
subject: Add login/tests