title: HTTP Request Testing in Pytest
body: <p>So I am very new to coding in general and I have written the following code to pass HTTP requests to Python/Django methods to test them with Pytest:</p>
  
  <pre><code>import django
  django.setup()
  from login.views import delete_song, delete_playlist, create_song, logout_user, add_preferences, create_playlist, detail, login_user
  from django.shortcuts import render, get_object_or_404
  from login.models import Playlist
  from django.test import TestCase
  from django.test import Client
  
  
  class test_songs(TestCase):
  
      def setUpClass(self):
          self.client = Client()
          self.post = ('POST /docs/index.html HTTP/1.1 Host: www.nowhere123.com Accept: image/gif, image/jpeg, / Accept-Language: en-us Accept-Encoding: gzip, deflate Content-Type: application/json User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) (blank line) {"foo": "bar"}')
  
      def test_login_pass(self):
          assert login_user(self) == render(self, 'index.html', {'playlists': Playlist.objects.filter(user=self.user)})
  
      def test_login_fail(self):
          assert login_user(self) == render(self, 'login.html', {'error_message': 'Invalid login'})
  
      def test_create_playlist(self):
          assert create_playlist(self) == render(self.post, 'create_playlist.html', context)
  
      def test_create_song(self):
          assert create_song(self,111) == render(self, 'detail.html', {'playlist': get_object_or_404(Playlist, pk=111)})
  
      def test_add_preference(self):
          assert add_preferences(x, 111) == render(x, 'add_preferences.html', context)
  
      def test_delete_song(self):
          assert delete_song(x,111,222) == render(x,'detail.html', {'playlist': get_object_or_404(Playlist, pk=111)})
  
      def test_detail(self):
          assert detail(self, 111) == render(self, 'detail.html',{'playlist': get_object_or_404(Playlist, pk=111), 'user': self.user})
  
      def test_detail_not_auth(self):
          assert detail('nonuser', 111)== render('nonuser', 'login.html')
  
      def test_delete_playlist(self):
          assert delete_playlist(x, 111) == render(x, 'detail.html', {'playlist': Playlist.objects.get(pk=111)})
  
      def test_logout_user(self):
          assert logout_user(x) == render(x, 'login.html', context)
  </code></pre>
  
  <p>but I keep getting the error when running them:</p>
  
  <pre><code>TypeError: setUpClass() missing 1 required positional argument: 'self'
  </code></pre>
  
  <p>I know there is probably a ton wrong with this code but getting past this hurdle would get me moving.</p>