コード例 #1
0
ファイル: tests.py プロジェクト: schocco/mds-web
    def test_import(self):
        """
        Uses the load module to read gpx data, which contains long, lat and altitude
        """
        path = os.path.dirname(__file__)
        gpx_file = os.path.join(path, "data/BadWildbad.gpx")
        self.assertTrue(os.path.exists(gpx_file))
        ls = GPXReader(gpx_file)
        self.assertIsNotNone(ls.to_linestring())

        t1 = Trail()
        t1.name = "Testtrail GPX"
        t1.owner = User.objects.get(pk=1)
        t1.waypoints = ls.to_linestring()
        t1.save()
        self.assertIsNotNone(t1.created, "timestamp has not been added automatically")
        self.assertIsNotNone(t1.edited, "timestamp has not been added automatically")
コード例 #2
0
ファイル: tests.py プロジェクト: schocco/mds-web
 def test_creation(self):
     t1 = Trail()
     t1.name = "Testtrail1"
     t1.owner = User.objects.get(pk=1)
     t1.waypoints = MultiLineString(
         LineString(
             (48.75118072, 8.539638519, 712),
             (48.75176078, 8.541011810, 696),
             (48.75133635, 8.545153141, 556),
             (48.75067140, 8.545582294, 531),
         )
     )
     t1.save()
     self.assertIsNotNone(t1.created, "timestamp has not been added automatically")
     self.assertIsNotNone(t1.edited, "timestamp has not been added automatically")
     t1.name = "Testtrail"
     t1.save()
     self.assertGreater(t1.edited, t1.created, "edited timestamp was not updated after save operation")