Beispiel #1
0
    def setUp(self):
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()
        db.create_all()
        self.client = self.app.test_client()

        self.user_1 = Users(username='******')
        self.user_1.insert()

        self.packing_list_1 = PackingLists(title='To Mars',
                                           user_id=1,
                                           num_of_days=6,
                                           destination="Mars")
        self.packing_list_1.insert()

        self.item_1 = Item(item='Hat',
                           category='Accessory',
                           weather='Hot',
                           gender='All')
        self.item_1.insert()
        self.item_2 = Item(item='Watch',
                           category='Accessory',
                           weather='All',
                           gender='All')
        self.item_2.insert()

        item_list_1 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_1.id,
                                quantity=5,
                                is_checked=True)
        item_list_1.insert()
        item_list_2 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_2.id,
                                quantity=6,
                                is_checked=False)
        item_list_2.insert()

        custom_item_1 = CustomItem(item="toy car",
                                   quantity=1,
                                   is_checked=False,
                                   category="toy",
                                   packing_list_id=self.packing_list_1.id)
        custom_item_1.insert()

        custom_item_2 = CustomItem(item="car",
                                   quantity=1,
                                   is_checked=False,
                                   category="transportaion",
                                   packing_list_id=self.packing_list_1.id)
        custom_item_2.insert()

        self.payload = {
            "data": {
                "item": {
                    "id": custom_item_1.id,
                    "category": "toy"
                }
            }
        }
Beispiel #2
0
    def post(self):
        data = request.get_json()
        user_id = data['data']['userID']
        title = data['data']['tripDetails']['title']
        number_of_days = data['data']['tripDetails']['duration']
        destination = data['data']['tripDetails']['destination']
        items_mappings = data['data']['items']

        packing_list = PackingLists(title=title,
                                    user_id=user_id,
                                    num_of_days=number_of_days,
                                    destination=destination)

        packing_list.insert()

        for item in items_mappings:
            item["packing_list_id"] = packing_list.id

        db.session.bulk_insert_mappings(ItemLists, items_mappings)
        db.session.commit()

        return {
            "data": {
                "listId": packing_list.id,
                "message": "Packing List Saved!",
                "status_code": 200
            }
        }
Beispiel #3
0
  def setUp(self):
    self.app = create_app('testing')
    self.app_context = self.app.app_context()
    self.app_context.push()
    db.create_all()
    self.client = self.app.test_client()

    self.user_1 = Users(username = "******")
    self.user_1.insert()
    self.user_2 = Users(username = "******")
    self.user_2.insert()

    self.item_1 = Item(category = 'Accessories', weather = 'ALl', gender = 'All', item = 'Hats')
    self.item_1.insert()
    self.item_2 = Item(category = 'Toiletries', weather = 'ALl', gender = 'All', item = 'Birth Control')
    self.item_2.insert()
    self.item_3 = Item(category = 'Clothing', weather = 'ALl', gender = 'All', item = 'Pants')
    self.item_3.insert()
    self.item_4 = Item(category = 'Toiletries', weather = 'ALl', gender = 'All', item = 'Condom')
    self.item_4.insert()
    self.item_5 = Item(category = 'Accessories', weather = 'ALl', gender = 'All', item = 'Belts')
    self.item_5.insert()


    self.packing_list_1 = PackingLists(title = "Hawaii Trip", user_id = 1, num_of_days = 7, destination = "Hawaii")
    self.packing_list_1.insert()

    self.packing_list_2 = PackingLists(title = "Paris Trip", user_id = 2, num_of_days = 20, destination = "Paris")
    self.packing_list_2.insert()

    self.item_list_1 = ItemLists(packing_list_id = 1, item_id = self.item_1.id, quantity = 5, is_checked = False)
    self.item_list_1.insert()

    self.item_list_2 = ItemLists(packing_list_id = 1, item_id = self.item_5.id, quantity = 50, is_checked = True)
    self.item_list_2.insert()

    self.item_list_3 = ItemLists(packing_list_id = 1, item_id = self.item_2.id, quantity = 20, is_checked = True)
    self.item_list_3.insert()

    self.item_list_4 = ItemLists(packing_list_id = 2, item_id = self.item_3.id, quantity = 4, is_checked = True)
    self.item_list_4.insert()

    self.item_list_5 = ItemLists(packing_list_id = 2, item_id = self.item_4.id, quantity = 100, is_checked = False)
    self.item_list_5.insert()

    self.custom_item_1 = CustomItem(item='Earrings', quantity=2, is_checked=False, category='Accessories', packing_list_id=1)
    self.custom_item_1.insert()

    self.custom_item_2 = CustomItem(item='Toy Car', quantity=2, is_checked=False, category='Toys', packing_list_id=1)
    self.custom_item_2.insert()
    def test_it_updates_packing_list(self):
        packing_list_1 = PackingLists(title='To Mars',
                                      user_id=1,
                                      num_of_days=6,
                                      destination="Mars")
        packing_list_1.insert()

        response = self.client.patch('/api/v1/packing_lists/1',
                                     json=(self.payload),
                                     content_type='application/json')

        self.assertEqual(200, response.status_code)
        data = json.loads(response.data.decode('utf-8'))

        self.assertEqual(1, data['list_id'])
        self.assertEqual('To Jupiter', data['title'])
        self.assertEqual(4, data['duration'])
        self.assertEqual('Jupiter', data['destination'])
Beispiel #5
0
  def test_it_saves_the_custom_item(self):
    user = Users(username='******')
    user.insert()

    packing_list = PackingLists(title='To Mars', user_id=user.id, num_of_days=6, destination="Mars")
    packing_list.insert()

    payload = {
        "data": {
            "type": "custom item",
            "attributes": {
                "item": "PS5",
                "quantity": 1,
                "category": "video games",
                "packing_list_id": packing_list.id
            }
        }
    }

    response = self.client.post(
      '/api/v1/custom_item/new', json=(payload),
      content_type='application/json'
    )

    self.assertEqual(200, response.status_code)

    data = json.loads(response.data.decode('utf-8'))

    item = db.session.query(CustomItem).first()
    
    self.assertEqual('Custom Item Saved!', data['message'])
    self.assertEqual(200, data['status_code'])
    self.assertEqual("PS5", item.item)
    self.assertEqual(1, item.quantity)
    self.assertEqual(False, item.is_checked)
    self.assertEqual("video games", item.category)
    self.assertEqual(1, item.packing_list_id)
    def test_it_returns_a_list_of_items(self):
        user_2 = Users(username='******')
        user_2.insert()

        packing_list_1 = PackingLists(title='To Mars',
                                      user_id=1,
                                      num_of_days=6,
                                      destination="Mars")
        packing_list_1.insert()
        packing_list_2 = PackingLists(title='London',
                                      user_id=1,
                                      num_of_days=2,
                                      destination="UK")
        packing_list_2.insert()
        packing_list_3 = PackingLists(title='Tokyo',
                                      user_id=2,
                                      num_of_days=7,
                                      destination="Japan")
        packing_list_3.insert()

        response = self.client.get(
            f'/api/v1/users/{self.user_1.id}/packing_lists')

        self.assertEqual(200, response.status_code)
        data = json.loads(response.data.decode('utf-8'))['data']

        self.assertEqual(2, len(data['attributes']['PackingLists']))
        self.assertEqual(packing_list_1.id,
                         data['attributes']['PackingLists'][1]['list_id'])
        self.assertEqual(packing_list_1.title,
                         data['attributes']['PackingLists'][1]['title'])
        self.assertEqual(packing_list_1.num_of_days,
                         data['attributes']['PackingLists'][1]['duration'])
        self.assertEqual(packing_list_1.destination,
                         data['attributes']['PackingLists'][1]['destination'])
class GetAllUserPackingLists(unittest.TestCase):
    def setUp(self):
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()
        db.create_all()
        self.client = self.app.test_client()

        self.user_1 = Users(username='******')
        self.user_1.insert()

        self.packing_list_1 = PackingLists(title='To Mars',
                                           user_id=1,
                                           num_of_days=6,
                                           destination="Mars")
        self.packing_list_1.insert()

        self.item_1 = Item(item='Hat',
                           category='Accessory',
                           weather='Hot',
                           gender='All')
        self.item_1.insert()
        self.item_2 = Item(item='Watch',
                           category='Accessory',
                           weather='All',
                           gender='All')
        self.item_2.insert()

        item_list_1 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_1.id,
                                quantity=5,
                                is_checked=True)
        item_list_1.insert()
        item_list_2 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_2.id,
                                quantity=6,
                                is_checked=False)
        item_list_2.insert()

        self.payload = {"data": {"item": {"id": item_list_1.id}}}

    def tearDown(self):
        db.session.remove()
        db_drop_everything(db)
        self.app_context.pop()

    def test_packing_list_can_be_deleted(self):
        payload = deepcopy(self.payload)

        #Assertions before delete
        all_item_lists = db.session.query(ItemLists).all()
        self.assertEqual(2, len(all_item_lists))

        #Calling route
        response = self.client.delete('/api/v1/item_list/update',
                                      json=(payload),
                                      content_type='application/json')

        #Assertions after delete
        self.assertEqual(200, response.status_code)
        data = json.loads(response.data.decode('utf-8'))
        success = "Packing list item has been deleted"

        self.assertEqual(success, data["success"])

        all_item_lists = db.session.query(ItemLists).all()

        self.assertEqual(1, len(all_item_lists))

    def test_error_message_if_packing_list_does_not_exists(self):
        payload = deepcopy(self.payload)

        # Fist call to delete the item list
        response = self.client.delete('/api/v1/item_list/update',
                                      json=(payload),
                                      content_type='application/json')

        self.assertEqual(200, response.status_code)

        # Second call trying to delete what is not there anymore
        response = self.client.delete('/api/v1/item_list/update',
                                      json=(payload),
                                      content_type='application/json')
        self.assertEqual(200, response.status_code)

        data = json.loads(response.data.decode('utf-8'))
        error = "Packing list item does not exists"

        self.assertEqual(error, data['error'])
Beispiel #8
0
    def test_packing_list_can_be_deleted(self):
        #Creating table info
        self.user_1 = Users(username='******')
        self.user_1.insert()

        self.packing_list_1 = PackingLists(title='To Mars',
                                           user_id=1,
                                           num_of_days=6,
                                           destination="Mars")
        self.packing_list_1.insert()
        self.packing_list_2 = PackingLists(title='London',
                                           user_id=1,
                                           num_of_days=2,
                                           destination="UK")
        self.packing_list_2.insert()

        self.item_1 = Item(item='Hat',
                           category='Accessory',
                           weather='Hot',
                           gender='All')
        self.item_1.insert()
        self.item_2 = Item(item='Watch',
                           category='Accessory',
                           weather='All',
                           gender='All')
        self.item_2.insert()

        item_list_1 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_1.id,
                                quantity=5,
                                is_checked=True)
        item_list_1.insert()
        item_list_2 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_2.id,
                                quantity=6,
                                is_checked=False)
        item_list_2.insert()

        #Assertions before delete
        all_packing_lists = db.session.query(PackingLists).all()
        all_item_lists = db.session.query(ItemLists).all()

        self.assertEqual(2, len(all_packing_lists))
        self.assertEqual(2, len(all_packing_lists[0].item_lists))
        self.assertEqual(2, len(all_item_lists))

        #Calling route
        response = self.client.delete(
            f'/api/v1/packing_lists/{self.packing_list_1.id}')

        #Assertions after delete
        self.assertEqual(200, response.status_code)

        data = json.loads(response.data.decode('utf-8'))
        success = "Packing list has been deleted"

        self.assertEqual(success, data["success"])

        all_packing_lists = db.session.query(PackingLists).all()
        all_item_lists = db.session.query(ItemLists).all()

        self.assertEqual(1, len(all_packing_lists))
        self.assertEqual(0, len(all_item_lists))
Beispiel #9
0
class GetAllUserPackingLists(unittest.TestCase):
    def setUp(self):
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()
        db.create_all()
        self.client = self.app.test_client()

    def tearDown(self):
        db.session.remove()
        db_drop_everything(db)
        self.app_context.pop()

    def test_packing_list_can_be_deleted(self):
        #Creating table info
        self.user_1 = Users(username='******')
        self.user_1.insert()

        self.packing_list_1 = PackingLists(title='To Mars',
                                           user_id=1,
                                           num_of_days=6,
                                           destination="Mars")
        self.packing_list_1.insert()
        self.packing_list_2 = PackingLists(title='London',
                                           user_id=1,
                                           num_of_days=2,
                                           destination="UK")
        self.packing_list_2.insert()

        self.item_1 = Item(item='Hat',
                           category='Accessory',
                           weather='Hot',
                           gender='All')
        self.item_1.insert()
        self.item_2 = Item(item='Watch',
                           category='Accessory',
                           weather='All',
                           gender='All')
        self.item_2.insert()

        item_list_1 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_1.id,
                                quantity=5,
                                is_checked=True)
        item_list_1.insert()
        item_list_2 = ItemLists(packing_list_id=self.packing_list_1.id,
                                item_id=self.item_2.id,
                                quantity=6,
                                is_checked=False)
        item_list_2.insert()

        #Assertions before delete
        all_packing_lists = db.session.query(PackingLists).all()
        all_item_lists = db.session.query(ItemLists).all()

        self.assertEqual(2, len(all_packing_lists))
        self.assertEqual(2, len(all_packing_lists[0].item_lists))
        self.assertEqual(2, len(all_item_lists))

        #Calling route
        response = self.client.delete(
            f'/api/v1/packing_lists/{self.packing_list_1.id}')

        #Assertions after delete
        self.assertEqual(200, response.status_code)

        data = json.loads(response.data.decode('utf-8'))
        success = "Packing list has been deleted"

        self.assertEqual(success, data["success"])

        all_packing_lists = db.session.query(PackingLists).all()
        all_item_lists = db.session.query(ItemLists).all()

        self.assertEqual(1, len(all_packing_lists))
        self.assertEqual(0, len(all_item_lists))

    def test_error_message_if_packing_list_does_not_exists(self):
        response = self.client.delete('/api/v1/packing_lists/1')

        data = json.loads(response.data.decode('utf-8'))
        error = "Packing list does not exists"

        self.assertEqual(error, data['error'])
Beispiel #10
0
class GetAllItemLists(unittest.TestCase):
  def setUp(self):
    self.app = create_app('testing')
    self.app_context = self.app.app_context()
    self.app_context.push()
    db.create_all()
    self.client = self.app.test_client()

    self.user_1 = Users(username = "******")
    self.user_1.insert()
    self.user_2 = Users(username = "******")
    self.user_2.insert()

    self.item_1 = Item(category = 'Accessories', weather = 'ALl', gender = 'All', item = 'Hats')
    self.item_1.insert()
    self.item_2 = Item(category = 'Toiletries', weather = 'ALl', gender = 'All', item = 'Birth Control')
    self.item_2.insert()
    self.item_3 = Item(category = 'Clothing', weather = 'ALl', gender = 'All', item = 'Pants')
    self.item_3.insert()
    self.item_4 = Item(category = 'Toiletries', weather = 'ALl', gender = 'All', item = 'Condom')
    self.item_4.insert()
    self.item_5 = Item(category = 'Accessories', weather = 'ALl', gender = 'All', item = 'Belts')
    self.item_5.insert()


    self.packing_list_1 = PackingLists(title = "Hawaii Trip", user_id = 1, num_of_days = 7, destination = "Hawaii")
    self.packing_list_1.insert()

    self.packing_list_2 = PackingLists(title = "Paris Trip", user_id = 2, num_of_days = 20, destination = "Paris")
    self.packing_list_2.insert()

    self.item_list_1 = ItemLists(packing_list_id = 1, item_id = self.item_1.id, quantity = 5, is_checked = False)
    self.item_list_1.insert()

    self.item_list_2 = ItemLists(packing_list_id = 1, item_id = self.item_5.id, quantity = 50, is_checked = True)
    self.item_list_2.insert()

    self.item_list_3 = ItemLists(packing_list_id = 1, item_id = self.item_2.id, quantity = 20, is_checked = True)
    self.item_list_3.insert()

    self.item_list_4 = ItemLists(packing_list_id = 2, item_id = self.item_3.id, quantity = 4, is_checked = True)
    self.item_list_4.insert()

    self.item_list_5 = ItemLists(packing_list_id = 2, item_id = self.item_4.id, quantity = 100, is_checked = False)
    self.item_list_5.insert()

    self.custom_item_1 = CustomItem(item='Earrings', quantity=2, is_checked=False, category='Accessories', packing_list_id=1)
    self.custom_item_1.insert()

    self.custom_item_2 = CustomItem(item='Toy Car', quantity=2, is_checked=False, category='Toys', packing_list_id=1)
    self.custom_item_2.insert()

  def tearDown(self):
    db.session.remove()
    db_drop_everything(db)
    self.app_context.pop()

  def test_it_returns_all_item_list_for_packing_list(self):
    response = self.client.get(
      f'/api/v1/packing_lists/{self.packing_list_1.id}'
    )

    self.assertEqual(200, response.status_code)

    data = json.loads(response.data.decode('utf-8'))['data']

    self.assertEqual(3, len(data['attributes']['categories']['Accessories']))
    self.assertEqual(1, len(data['attributes']['categories']['Toiletries']))
    self.assertEqual('Hats', data['attributes']['categories']['Accessories'][0]['name'])
    self.assertEqual('Belts', data['attributes']['categories']['Accessories'][1]['name'])
    self.assertEqual('Earrings', data['attributes']['categories']['Accessories'][2]['name'])
    self.assertEqual('Birth Control', data['attributes']['categories']['Toiletries'][0]['name'])
    self.assertEqual('Toy Car', data['attributes']['categories']['Toys'][0]['name'])
    self.assertEqual(1, data['attributes']['tripDetails']['listId'])
    self.assertEqual('Hawaii Trip', data['attributes']['tripDetails']['title'])
    self.assertEqual(7, data['attributes']['tripDetails']['duration'])
    self.assertEqual('Hawaii', data['attributes']['tripDetails']['destination'])
    def setUp(self):
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()
        db.create_all()
        self.client = self.app.test_client()

        self.user_1 = Users(username='******')
        self.user_1.insert()

        self.packing_list_1 = PackingLists(title='To Mars',
                                           user_id=1,
                                           num_of_days=6,
                                           destination="Mars")
        self.packing_list_1.insert()

        self.item_1 = Item(category='Accessories',
                           weather='ALl',
                           gender='All',
                           item='Hats')
        self.item_1.insert()
        self.item_2 = Item(category='Toiletries',
                           weather='ALl',
                           gender='All',
                           item='Birth Control')
        self.item_2.insert()
        self.item_3 = Item(category='Clothing',
                           weather='ALl',
                           gender='All',
                           item='Pants')
        self.item_3.insert()
        self.item_4 = Item(category='Toiletries',
                           weather='ALl',
                           gender='All',
                           item='Condom')
        self.item_4.insert()
        self.item_5 = Item(category='Accessories',
                           weather='ALl',
                           gender='All',
                           item='Belts')
        self.item_5.insert()

        self.item_list_1 = ItemLists(packing_list_id=self.packing_list_1.id,
                                     item_id=self.item_1.id,
                                     quantity=5,
                                     is_checked=False)
        self.item_list_1.insert()

        self.item_list_2 = ItemLists(packing_list_id=self.packing_list_1.id,
                                     item_id=self.item_5.id,
                                     quantity=50,
                                     is_checked=True)
        self.item_list_2.insert()

        self.item_list_3 = ItemLists(packing_list_id=self.packing_list_1.id,
                                     item_id=self.item_2.id,
                                     quantity=20,
                                     is_checked=True)
        self.item_list_3.insert()

        self.custom_item = CustomItem(item='Belt',
                                      quantity=0,
                                      category='Accessories',
                                      is_checked=False,
                                      packing_list_id=self.packing_list_1.id)
        self.custom_item.insert()

        self.bulk_items_payload = {
            "data": {
                "item": [{
                    "id": self.custom_item.id,
                    "is_checked": True,
                    "quantity": 32,
                    "category": "something"
                }, {
                    "id": self.item_list_1.id,
                    "is_checked": True,
                    "quantity": 16
                }]
            }
        }

        self.single_item_payload_custom = {
            "data": {
                "item": [{
                    "id": self.custom_item.id,
                    "is_checked": True,
                    "quantity": 32,
                    "category": "something"
                }]
            }
        }

        self.single_item_payload_item_list = {
            "data": {
                "item": [{
                    "id": self.item_list_1.id,
                    "is_checked": True,
                    "quantity": 32
                }]
            }
        }
class GetAllUserPackingLists(unittest.TestCase):
    def setUp(self):
        self.app = create_app('testing')
        self.app_context = self.app.app_context()
        self.app_context.push()
        db.create_all()
        self.client = self.app.test_client()

        self.user_1 = Users(username='******')
        self.user_1.insert()

        self.packing_list_1 = PackingLists(title='To Mars',
                                           user_id=1,
                                           num_of_days=6,
                                           destination="Mars")
        self.packing_list_1.insert()

        self.item_1 = Item(category='Accessories',
                           weather='ALl',
                           gender='All',
                           item='Hats')
        self.item_1.insert()
        self.item_2 = Item(category='Toiletries',
                           weather='ALl',
                           gender='All',
                           item='Birth Control')
        self.item_2.insert()
        self.item_3 = Item(category='Clothing',
                           weather='ALl',
                           gender='All',
                           item='Pants')
        self.item_3.insert()
        self.item_4 = Item(category='Toiletries',
                           weather='ALl',
                           gender='All',
                           item='Condom')
        self.item_4.insert()
        self.item_5 = Item(category='Accessories',
                           weather='ALl',
                           gender='All',
                           item='Belts')
        self.item_5.insert()

        self.item_list_1 = ItemLists(packing_list_id=self.packing_list_1.id,
                                     item_id=self.item_1.id,
                                     quantity=5,
                                     is_checked=False)
        self.item_list_1.insert()

        self.item_list_2 = ItemLists(packing_list_id=self.packing_list_1.id,
                                     item_id=self.item_5.id,
                                     quantity=50,
                                     is_checked=True)
        self.item_list_2.insert()

        self.item_list_3 = ItemLists(packing_list_id=self.packing_list_1.id,
                                     item_id=self.item_2.id,
                                     quantity=20,
                                     is_checked=True)
        self.item_list_3.insert()

        self.custom_item = CustomItem(item='Belt',
                                      quantity=0,
                                      category='Accessories',
                                      is_checked=False,
                                      packing_list_id=self.packing_list_1.id)
        self.custom_item.insert()

        self.bulk_items_payload = {
            "data": {
                "item": [{
                    "id": self.custom_item.id,
                    "is_checked": True,
                    "quantity": 32,
                    "category": "something"
                }, {
                    "id": self.item_list_1.id,
                    "is_checked": True,
                    "quantity": 16
                }]
            }
        }

        self.single_item_payload_custom = {
            "data": {
                "item": [{
                    "id": self.custom_item.id,
                    "is_checked": True,
                    "quantity": 32,
                    "category": "something"
                }]
            }
        }

        self.single_item_payload_item_list = {
            "data": {
                "item": [{
                    "id": self.item_list_1.id,
                    "is_checked": True,
                    "quantity": 32
                }]
            }
        }

    def tearDown(self):
        db.session.remove()
        db_drop_everything(db)
        self.app_context.pop()

    def test_it_can_update_item_lists_and_custom_items_in_bulk(self):

        self.assertEqual(5, self.item_list_1.quantity)
        self.assertEqual(False, self.item_list_1.is_checked)

        self.assertEqual(50, self.item_list_2.quantity)
        self.assertEqual(True, self.item_list_2.is_checked)

        self.assertEqual(20, self.item_list_3.quantity)
        self.assertEqual(True, self.item_list_3.is_checked)
        payload = deepcopy(self.bulk_items_payload)

        response = self.client.patch('/api/v1/item_list/update',
                                     json=(payload),
                                     content_type='application/json')

        self.assertEqual(200, response.status_code)

        data = json.loads(response.data.decode('utf-8'))
        self.assertEqual("Items have been updated", data["success"])

        self.assertEqual(16, self.item_list_1.quantity)
        self.assertEqual(True, self.item_list_1.is_checked)

        self.assertEqual(50, self.item_list_2.quantity)
        self.assertEqual(True, self.item_list_2.is_checked)

        self.assertEqual(20, self.item_list_3.quantity)
        self.assertEqual(True, self.item_list_3.is_checked)

    def test_it_can_update_single_item_list(self):

        self.assertEqual(5, self.item_list_1.quantity)
        self.assertEqual(False, self.item_list_1.is_checked)

        payload = deepcopy(self.single_item_payload_item_list)

        response = self.client.patch('/api/v1/item_list/update',
                                     json=(payload),
                                     content_type='application/json')

        self.assertEqual(200, response.status_code)

        data = json.loads(response.data.decode('utf-8'))
        self.assertEqual("Item has been updated", data["success"])

        self.assertEqual(32, self.item_list_1.quantity)
        self.assertEqual(True, self.item_list_1.is_checked)

    def test_it_can_update_single_custom_item(self):

        self.assertEqual(0, self.custom_item.quantity)
        self.assertEqual(False, self.custom_item.is_checked)

        payload = deepcopy(self.single_item_payload_custom)

        response = self.client.patch('/api/v1/item_list/update',
                                     json=(payload),
                                     content_type='application/json')

        self.assertEqual(200, response.status_code)

        data = json.loads(response.data.decode('utf-8'))
        self.assertEqual("Item has been updated", data["success"])

        self.assertEqual(32, self.custom_item.quantity)
        self.assertEqual(True, self.custom_item.is_checked)