示例#1
0
class MapProductTest(unittest.TestCase):
    def setUp(self):
        self.product = Product('prod01', 'test product', 20.2)
        self.dict_produto = self.product.as_dict()

        self.mapped_product = Product()
        self.mapped_product.map_dict(self.dict_produto)

    def test_mapping_product_name(self):
        self.assertEqual(self.product.name, self.dict_produto['name'],
                         "attribute name was not mapped properly ")

    def test_mapping_product_description(self):
        self.assertEqual(self.product.description,
                         self.dict_produto['description'],
                         "attribute description was not mapped properly ")

    def test_mapping_product_price(self):
        self.assertEqual(self.product.price, self.dict_produto['price'],
                         "attribute price was not mapped properly ")

    def test_mapping_return_product_name(self):
        self.assertEqual(self.product.name, self.mapped_product.name,
                         "attribute return_p.name was not mapped properly ")

    def test_mapping_return_product_description(self):
        self.assertEqual(
            self.product.description, self.mapped_product.description,
            "attribute return_p.description was not mapped properly ")

    def test_mapping_return_product_price(self):
        self.assertEqual(self.product.price, self.mapped_product.price,
                         "attribute return_p.price was not mapped properly ")
示例#2
0
class MapProductTest(unittest.TestCase):
    def setUp(self):
        self.product = Product('prod01', 'test product', 20.2)
        self.dict_produto = self.product.as_dict()

        self.mapped_product = Product()
        self.mapped_product.map_dict(self.dict_produto)

    def test_mapping_product_name(self):
        self.assertEqual(self.product.name, self.dict_produto['name'], "attribute name was not mapped properly ")

    def test_mapping_product_description(self):
        self.assertEqual(self.product.description, self.dict_produto['description'],
                         "attribute description was not mapped properly ")

    def test_mapping_product_price(self):
        self.assertEqual(self.product.price, self.dict_produto['price'], "attribute price was not mapped properly ")

    def test_mapping_return_product_name(self):
        self.assertEqual(self.product.name, self.mapped_product.name,
                         "attribute return_p.name was not mapped properly ")

    def test_mapping_return_product_description(self):
        self.assertEqual(self.product.description, self.mapped_product.description,
                         "attribute return_p.description was not mapped properly ")

    def test_mapping_return_product_price(self):
        self.assertEqual(self.product.price, self.mapped_product.price,
                         "attribute return_p.price was not mapped properly ")
示例#3
0
    def setUp(self):
        self.product = Product('prod01', 'test product', 20.2)
        self.dict_produto = self.product.as_dict()

        self.mapped_product = Product()
        self.mapped_product.map_dict(self.dict_produto)
示例#4
0
    def setUp(self):
        self.product = Product('prod01', 'test product', 20.2)
        self.dict_produto = self.product.as_dict()

        self.mapped_product = Product()
        self.mapped_product.map_dict(self.dict_produto)