Esempio n. 1
0
 def test_new_sailing_changed_point(self):
     self.distances[0] = (579, 580, Decimal('4.8'), False)
     plp.db_write_points(self.points, self.new_sailing)
     plp.db_write_distances(self.distances, self.new_sailing)
     self.assertEqual(len(Distance.objects.all()), len(self.distances) + 1)
     self.assertEqual(len(self.new_sailing.distances.all()),
                      len(self.distances))
Esempio n. 2
0
 def test_distance_with_nonexisting_point(self):
     Distance.objects.all().delete()
     distances = self.distances[:]
     distances.append((100, 580, Decimal('1.0'), False))
     saved_stderr = sys.stderr
     try:
         err = StringIO()
         sys.stderr = err
         plp.db_write_distances(distances, self.sailing)
         output = err.getvalue().strip()
         self.assertEqual(output, "Warning following distance not added: (100, 580, Decimal('1.0'), False)")
     finally:
         sys.stderr = saved_stderr
Esempio n. 3
0
 def test_new_sailing_same_points(self):
     plp.db_write_points(self.points, self.new_sailing)
     plp.db_write_distances(self.distances, self.new_sailing)
     self.assertEqual(len(Distance.objects.all()), len(self.distances))
Esempio n. 4
0
 def setUp(self):
     super(TestDBWriteDistances, self).setUp()
     plp.db_write_points(self.points, self.sailing)
     plp.db_write_distances(self.distances, self.sailing)