Beispiel #1
0
 def testSaveGeoFormDataFromXsd(self):
     """Test form definition with geopoint"""
     filename = replace_in_file(self.instance_filename, "REPLACE_ME", 
                                "%s %s %s %s" % (LAT, LON, ALT, ACC))
     create_xsd_and_populate("data/geopoint/geopoint_form.xsd",
                             filename,
                             self.domain)
     self._check_row()
Beispiel #2
0
 def testSaveGeoDataMissingFields(self):
     """Test form definition with geopoint - EXTRA FIELDS"""
     filename = replace_in_file(self.instance_filename, "REPLACE_ME", 
                                "%s" % (LAT))
     create_xsd_and_populate("data/geopoint/geopoint_form.xhtml",
                             filename,
                             self.domain)
     self._check_row(LAT, None, None, None)
     
     filename = replace_in_file(self.instance_filename, "REPLACE_ME", 
                                "%s %s" % (LAT, LON))
     populate(filename, self.domain)
     self._check_row(LAT, LON, None, None)
     
     filename = replace_in_file(self.instance_filename, "REPLACE_ME", 
                                "%s %s %s" % (LAT, LON, ALT))
     populate(filename, self.domain)
     self._check_row(LAT, LON, ALT, None)
Beispiel #3
0
 def testSaveGeoDataNoNode(self):
     """Test form definition with geopoint - no submitted data"""
     filename = replace_in_file(self.instance_filename, 
                                "<GPSCOORDS_data>REPLACE_ME</GPSCOORDS_data>", 
                                "")
     create_xsd_and_populate("data/geopoint/geopoint_form.xhtml",
                             filename,
                             self.domain)
     self._check_row(None, None, None, None)
Beispiel #4
0
 def testSaveExtraValues(self):
     """Test form definition with geopoint"""
     filename = replace_in_file(self.instance_filename, "REPLACE_ME", 
                                "%s %s %s %s %s" % (LAT, LON, ALT, ACC, "0.211"))
     
     # unfortunately this doesn't fail hard, so we just check for the 
     # lack of a row to confirm that it didn't succeed
     form = create_xsd_and_populate("data/geopoint/geopoint_form.xhtml",
                             filename,
                             self.domain)
     cursor = connection.cursor()
     cursor.execute("SELECT count(*) FROM schema_geodomain_moz_sarahdemo_2")
     self.assertEqual(0, cursor.fetchone()[0] )