Exemplo n.º 1
0
    def test_0a_1_5_1_MyModel_deep(self):
        # Testing update
        # Creating the product
        product_to_del = Product(name="Cheese",
                                 price=50.4,
                                 quantity=7.89,
                                 id=10000000,
                                 code=789456611)
        product_to_del.insert()
        #prod = Product(name="789",price=123,seller_id=1)
        #prod.insert()
        #print(product_to_del.deep())
        self.assertEqual(
            product_to_del.deep(), {
                'categories': [],
                'code': 789456611,
                'id': 1,
                'name': 'Cheese',
                'price': 50.4,
                'quantity': 7.89
            })
        """self.assertEqual(prod.deep(),{'id': 1, 'in_stock': True,
			'name': '789', 'orders': [], 'price': 123.0, 'seller':
			{'id': 1, 'username': '******'}, 'seller_id': 1})"""
        print("Test 0a_1_5_1 : MyModel: deep")
Exemplo n.º 2
0
 def test_0a_1_5_1_MyModel_deep(self):
     # Testing update
     # Creating the user
     user_to_del = User(username="******", password="******")
     user_to_del.insert()
     prod = Product(name="789", price=123, seller_id=1)
     prod.insert()
     self.assertEqual(
         user_to_del.deep(),
         {
             'id':
             1,  #'images': [],
             'orders': [],
             'products': [{
                 'id': 1,
                 'in_stock': True,
                 'name': '789',
                 'price': 123.0,
                 'seller_id': 1
             }],
             'username':
             '******'
         })
     self.assertEqual(
         prod.deep(), {
             'id': 1,
             'in_stock': True,
             'name': '789',
             'orders': [],
             'price': 123.0,
             'seller': {
                 'id': 1,
                 'username': '******'
             },
             'seller_id': 1
         })
     print("Test 0a_1_5_1 : MyModel: deep")