from __future__ import unicode_literals

from django.test import TestCase

from shop.models.cart import BaseCartItem


class JSONFieldTest(TestCase):
    """JSONField Wrapper Tests"""

    def test_json_field_create(self):
        """Test saving a JSON object in our JSONField"""
        json_obj = {
            "item_1": "this is a json blah",
            "blergh": "hey, hey, hey"}

        obj = BaseCartItem.objects.create(extra=json_obj)
        new_obj = BaseCartItem.objects.get(id=obj.id)

        self.assertEqual(new_obj.json, json_obj)

from __future__ import unicode_literals

from django.test import TestCase

from shop.models.defaults.customer import Customer


class JSONFieldTest(TestCase):
    """JSONField Wrapper Tests"""

    def test_json_field_create(self):
        """Test saving a JSON object in our JSONField"""
        json_obj = {
            "item_1": "this is a json blah",
            "blergh": "hey, hey, hey"}

        obj = Customer.objects.create(extra=json_obj)
        new_obj = Customer.objects.get(id=obj.id)

        self.assertEqual(new_obj.extra, json_obj)

Update model used to test
Update model used to test

  from __future__ import unicode_literals
  
  from django.test import TestCase
  
- from shop.models.cart import BaseCartItem
+ from shop.models.defaults.customer import Customer
  
  
  class JSONFieldTest(TestCase):
      """JSONField Wrapper Tests"""
  
      def test_json_field_create(self):
          """Test saving a JSON object in our JSONField"""
          json_obj = {
              "item_1": "this is a json blah",
              "blergh": "hey, hey, hey"}
  
-         obj = BaseCartItem.objects.create(extra=json_obj)
+         obj = Customer.objects.create(extra=json_obj)
-         new_obj = BaseCartItem.objects.get(id=obj.id)
+         new_obj = Customer.objects.get(id=obj.id)
  
-         self.assertEqual(new_obj.json, json_obj)
+         self.assertEqual(new_obj.extra, json_obj)
  
Update model used to test
## Code Before:
from __future__ import unicode_literals

from django.test import TestCase

from shop.models.cart import BaseCartItem


class JSONFieldTest(TestCase):
    """JSONField Wrapper Tests"""

    def test_json_field_create(self):
        """Test saving a JSON object in our JSONField"""
        json_obj = {
            "item_1": "this is a json blah",
            "blergh": "hey, hey, hey"}

        obj = BaseCartItem.objects.create(extra=json_obj)
        new_obj = BaseCartItem.objects.get(id=obj.id)

        self.assertEqual(new_obj.json, json_obj)

## Instruction:
Update model used to test
## Code After:
from __future__ import unicode_literals

from django.test import TestCase

from shop.models.defaults.customer import Customer


class JSONFieldTest(TestCase):
    """JSONField Wrapper Tests"""

    def test_json_field_create(self):
        """Test saving a JSON object in our JSONField"""
        json_obj = {
            "item_1": "this is a json blah",
            "blergh": "hey, hey, hey"}

        obj = Customer.objects.create(extra=json_obj)
        new_obj = Customer.objects.get(id=obj.id)

        self.assertEqual(new_obj.extra, json_obj)
