Пример #1
0
    def test_client2_was_successful_updated(self):
        yield self.emanager.remove_all()
        self.objectid_1 = yield self.emanager.save(self.client1)
        self.objectid_2 = yield self.emanager.save(self.client2)
        self.objectid_3 = yield self.emanager.save(self.client3)

        self.client_to_update = yield self.emanager.find_one(
            _id=self.objectid_2)
        self.client_to_update.name = "updated_name"
        self.client_to_update.last_name = "updated_last_name"

        yield self.emanager.update(self.client_to_update)

        self.updated_client = yield self.emanager.find_one(_id=self.objectid_2)

        self.return_client1 = yield self.emanager.find_one(_id=self.objectid_1)
        self.return_client3 = yield self.emanager.find_one(_id=self.objectid_3)

        # check if client2 was updated
        self.assertEqual(self.client_to_update.name, self.updated_client.name)
        self.assertEqual(self.client_to_update.last_name,
                         self.updated_client.last_name)

        # check if nothing changed in client1 and client3
        self.assertTrue(compare_objs(self.client1, self.return_client1))
        self.assertTrue(compare_objs(self.client3, self.return_client3))
Пример #2
0
    def test_client2_was_successful_updated(self):
        yield self.emanager.remove_all()
        self.objectid_1 = yield self.emanager.save(self.client1)
        self.objectid_2 = yield self.emanager.save(self.client2)
        self.objectid_3 = yield self.emanager.save(self.client3)

        self.client_to_update = yield self.emanager.find_one(_id=self.objectid_2)
        self.client_to_update.name = "updated_name"
        self.client_to_update.last_name = "updated_last_name"

        yield self.emanager.update(self.client_to_update)

        self.updated_client = yield self.emanager.find_one(_id=self.objectid_2)

        self.return_client1 = yield self.emanager.find_one(_id=self.objectid_1)
        self.return_client3 = yield self.emanager.find_one(_id=self.objectid_3)

        # check if client2 was updated
        self.assertEqual(self.client_to_update.name, self.updated_client.name)
        self.assertEqual(self.client_to_update.last_name, self.updated_client.last_name)

        # check if nothing changed in client1 and client3
        self.assertTrue(compare_objs(self.client1, self.return_client1))
        self.assertTrue(compare_objs(self.client3, self.return_client3))
Пример #3
0
 def test_saved_client_with_address(self):
     self.object_id = yield self.emanager.save(self.client)
     self.client_result = yield self.emanager.find_one(_id=self.object_id)
     yield self.emanager.remove(_id=self.object_id)
     self.assertTrue(compare_objs(self.client, self.client_result), "client with 3 addresses was not properly saved")
Пример #4
0
 def test_product_with_3_shipping_options(self):
     object_id = yield self.emanager.save(self.product)
     saved_product = yield self.emanager.find_one(_id=object_id)
     self.assertTrue(compare_objs(self.product, saved_product), "product was not properly saved")
Пример #5
0
 def test_saved_simple_client(self):
     object_id = yield self.emanager.save(self.simple_client)
     saved_client = yield self.emanager.find_one(_id=object_id)
     self.assertTrue(compare_objs(self.simple_client, saved_client), "client was not mapped")
Пример #6
0
 def test_saved_client_with_one_address(self):
     object_id = yield self.emanager.save(self.client_with_address)
     saved_client = yield self.emanager.find_one(_id=object_id)
     yield self.emanager.remove(_id=object_id)
     self.assertTrue(compare_objs(saved_client.address, self.address), "Address was not mapped")
Пример #7
0
 def test_client_address3_mapping(self):
     cl_addr_3 = self.client.address[2]
     rt_addr_3 = self.return_client.address[2]
     self.assertTrue(compare_objs(cl_addr_3, rt_addr_3),
                     "cl_addr_3 and rt_addr_3 are diferent")
Пример #8
0
 def test_client_address2_mapping(self):
     cl_addr_2 = self.client.address[1]
     rt_addr_2 = self.return_client.address[1]
     self.assertTrue(compare_objs(cl_addr_2, rt_addr_2),
                     "cl_addr_2 and rt_addr_2 are diferent")
Пример #9
0
 def test_client_address1_mapping(self):
     cl_addr_1 = self.client.address[0]
     rt_addr_1 = self.return_client.address[0]
     self.assertTrue(compare_objs(cl_addr_1, rt_addr_1),
                     "cl_addr_1 and rt_addr_1 are diferent")
Пример #10
0
 def test_client_address3_mapping(self):
     cl_addr_3 = self.client.address[2]
     rt_addr_3 = self.return_client.address[2]
     self.assertTrue(compare_objs(cl_addr_3, rt_addr_3), "cl_addr_3 and rt_addr_3 are diferent")
Пример #11
0
 def test_client_address2_mapping(self):
     cl_addr_2 = self.client.address[1]
     rt_addr_2 = self.return_client.address[1]
     self.assertTrue(compare_objs(cl_addr_2, rt_addr_2), "cl_addr_2 and rt_addr_2 are diferent")
Пример #12
0
 def test_client_address1_mapping(self):
     cl_addr_1 = self.client.address[0]
     rt_addr_1 = self.return_client.address[0]
     self.assertTrue(compare_objs(cl_addr_1, rt_addr_1), "cl_addr_1 and rt_addr_1 are diferent")
Пример #13
0
 def test_saved_client_with_address(self):
     self.object_id = yield self.emanager.save(self.client)
     self.client_result = yield self.emanager.find_one(_id=self.object_id)
     yield self.emanager.remove(_id=self.object_id)
     self.assertTrue(compare_objs(self.client, self.client_result),
                     "client with 3 addresses was not properly saved")
Пример #14
0
 def test_product_with_3_shipping_options(self):
     object_id = yield self.emanager.save(self.product)
     saved_product = yield self.emanager.find_one(_id=object_id)
     self.assertTrue(compare_objs(self.product, saved_product),
                     "product was not properly saved")
Пример #15
0
 def test_saved_simple_client(self):
     object_id = yield self.emanager.save(self.simple_client)
     saved_client = yield self.emanager.find_one(_id=object_id)
     self.assertTrue(compare_objs(self.simple_client, saved_client),
                     "client was not mapped")
Пример #16
0
 def test_saved_client_with_one_address(self):
     object_id = yield self.emanager.save(self.client_with_address)
     saved_client = yield self.emanager.find_one(_id=object_id)
     yield self.emanager.remove(_id=object_id)
     self.assertTrue(compare_objs(saved_client.address, self.address),
                     "Address was not mapped")