import json

from django.conf import settings
from django.test import TestCase

from go.api.go_api import client

from mock import patch


class ClientTestCase(TestCase):
    @patch('requests.request')
    def test_request(self, mock_req):
        client.request('123', 'lorem ipsum', 'GET')

        mock_req.assert_called_with(
            'GET',
            settings.GO_API_URL,
            auth=('session_id', '123'),
            data='lorem ipsum')

    @patch('requests.request')
    def test_rpc(self, mock_req):
        client.rpc('123', 'do_something', ['foo', 'bar'], id='abc')

        mock_req.assert_called_with(
            'POST',
            settings.GO_API_URL,
            auth=('session_id', '123'),
            data=json.dumps({
                'jsonrpc': '2.0',
                'id': 'abc',
                'params': ['foo', 'bar'],
                'method': 'do_something',
            }))

import json

from django.conf import settings
from django.test import TestCase

from go.api.go_api import client

from mock import patch


class ClientTestCase(TestCase):
    @patch('requests.request')
    def test_rpc(self, mock_req):
        client.rpc('123', 'do_something', ['foo', 'bar'], id='abc')

        mock_req.assert_called_with(
            'POST',
            settings.GO_API_URL,
            auth=('session_id', '123'),
            data=json.dumps({
                'jsonrpc': '2.0',
                'id': 'abc',
                'params': ['foo', 'bar'],
                'method': 'do_something',
            }))

Remove a test that is no longer relevant
Remove a test that is no longer relevant

  import json
  
  from django.conf import settings
  from django.test import TestCase
  
  from go.api.go_api import client
  
  from mock import patch
  
  
  class ClientTestCase(TestCase):
-     @patch('requests.request')
-     def test_request(self, mock_req):
-         client.request('123', 'lorem ipsum', 'GET')
- 
-         mock_req.assert_called_with(
-             'GET',
-             settings.GO_API_URL,
-             auth=('session_id', '123'),
-             data='lorem ipsum')
- 
      @patch('requests.request')
      def test_rpc(self, mock_req):
          client.rpc('123', 'do_something', ['foo', 'bar'], id='abc')
  
          mock_req.assert_called_with(
              'POST',
              settings.GO_API_URL,
              auth=('session_id', '123'),
              data=json.dumps({
                  'jsonrpc': '2.0',
                  'id': 'abc',
                  'params': ['foo', 'bar'],
                  'method': 'do_something',
              }))
  
Remove a test that is no longer relevant
## Code Before:
import json

from django.conf import settings
from django.test import TestCase

from go.api.go_api import client

from mock import patch


class ClientTestCase(TestCase):
    @patch('requests.request')
    def test_request(self, mock_req):
        client.request('123', 'lorem ipsum', 'GET')

        mock_req.assert_called_with(
            'GET',
            settings.GO_API_URL,
            auth=('session_id', '123'),
            data='lorem ipsum')

    @patch('requests.request')
    def test_rpc(self, mock_req):
        client.rpc('123', 'do_something', ['foo', 'bar'], id='abc')

        mock_req.assert_called_with(
            'POST',
            settings.GO_API_URL,
            auth=('session_id', '123'),
            data=json.dumps({
                'jsonrpc': '2.0',
                'id': 'abc',
                'params': ['foo', 'bar'],
                'method': 'do_something',
            }))

## Instruction:
Remove a test that is no longer relevant
## Code After:
import json

from django.conf import settings
from django.test import TestCase

from go.api.go_api import client

from mock import patch


class ClientTestCase(TestCase):
    @patch('requests.request')
    def test_rpc(self, mock_req):
        client.rpc('123', 'do_something', ['foo', 'bar'], id='abc')

        mock_req.assert_called_with(
            'POST',
            settings.GO_API_URL,
            auth=('session_id', '123'),
            data=json.dumps({
                'jsonrpc': '2.0',
                'id': 'abc',
                'params': ['foo', 'bar'],
                'method': 'do_something',
            }))
