Exemplo n.º 1
0
 def test_LogReportProductNotFound_returnLog(self):
     self.st.throw_does_not_exists = True
     updater(test_data, self.st)
     #self.handler.flush()
     self.assertEqual(
         self.log_buf.getvalue(),
         "WARNING - Product with part number 1 does not exists. Skipping update.\n"
         "WARNING - Product with part number 2 does not exists. Skipping update.\n"
         "WARNING - Product with part number 3 does not exists. Skipping update.\n"
         "WARNING - Product with part number 4 does not exists. Skipping update.\n"
     )
Exemplo n.º 2
0
 def test_LogReportMultiplesProductFound_returnLog(self):
     self.st.throw_mult_objs = True
     updater(test_data, self.st)
     #self.handler.flush()
     self.assertEqual(
         self.log_buf.getvalue(),
         'WARNING - Multiple Products with part number 1. Skipping update for those ones.\n'
         'WARNING - Multiple Products with part number 2. Skipping update for those ones.\n'
         'WARNING - Multiple Products with part number 3. Skipping update for those ones.\n'
         'WARNING - Multiple Products with part number 4. Skipping update for those ones.\n'
     )
Exemplo n.º 3
0
 def test_WrongValuePrices_returnLog(self):
     stats = updater(test_data_bad_prices, self.st)
     self.assertEqual(
         self.log_buf.getvalue(),
         'WARNING - Wrong value. Skipping product with part number 1\n'
         'WARNING - Wrong value. Skipping product with part number 2\n')
Exemplo n.º 4
0
 def test_WrongValuePrices_return2(self):
     stats = updater(test_data_bad_prices, self.st)
     self.assertEqual(stats['not_found'], 2)
     self.assertEqual(stats['total'], 2)
Exemplo n.º 5
0
 def test_MultiplesProductNotFound_returns4(self):
     self.st.throw_mult_objs = True
     stats = updater(test_data, self.st)
     self.assertEqual(stats['not_found'], 4)
     self.assertEqual(stats['total'], 4)
Exemplo n.º 6
0
 def test_NotFoundProduct_notfound4(self):
     self.st.throw_does_not_exists = True
     stats = updater(test_data, self.st)
     self.assertEqual(stats['not_found'], 4)
     self.assertEqual(stats['total'], 4)
Exemplo n.º 7
0
 def test_updateAllProducts_updated4(self):
     stats = updater(test_data, self.st)
     self.assertEqual(stats['updated'], 4)
     self.assertEqual(stats['total'], 4)
Exemplo n.º 8
0
 def test_createAllProducts_created4(self):
     self.st.created = True
     stats = updater(test_data, self.st)
     self.assertEqual(stats['created'], 4)
     self.assertEqual(stats['total'], 4)
Exemplo n.º 9
0
 def test_productListEmpty_return0(self):
     stats = updater([], self.st)
     self.assertEqual(stats['total'], 0)
     self.assertEqual(self.log_buf.getvalue(), '')