Esempio n. 1
0
 def test1ClearFormData(self):
     """ Tests clear out all forms. """
     create_xsd_and_populate("1_basic.xsd", "1_basic.xml", self.domain)
     create_xsd_and_populate("2_types.xsd", "2_types.xml", self.domain)
     create_xsd_and_populate("3_deep.xsd", "3_deep.xml", self.domain)
     create_xsd_and_populate("4_verydeep.xsd", "4_verydeep.xml", self.domain)
     create_xsd_and_populate("5_singlerepeat.xsd", "5_singlerepeat.xml", self.domain)
     create_xsd_and_populate("6_nestedrepeats.xsd", "6_nestedrepeats.xml", self.domain)
     create_xsd_and_populate("data/pf_followup.xsd", "data/pf_followup_1.xml", self.domain)
     su = StorageUtility()
     su.clear()
     cursor = connection.cursor()
     cursor.execute("SELECT * FROM xformmanager_formdefmodel")
     row = cursor.fetchone()
     self.assertEquals(row,None)
     cursor.execute("SELECT * FROM xformmanager_elementdefmodel")
     row = cursor.fetchone()
     self.assertEquals(row,None)
     cursor.execute("SELECT * FROM xformmanager_metadata")
     row = cursor.fetchone()
     self.assertEquals(row,None)
     if settings.DATABASE_ENGINE == 'mysql':
         cursor.execute("show tables like 'schema_remdomain_%'")
         row = cursor.fetchone()
         self.assertEquals(row,None)
Esempio n. 2
0
def clear_data():
    """Clear most of the data in the system: schemas,
       submissions, and attachments.  Useful in the 
       setup and/or teardown methods of tests.
    """
    su = StorageUtility()
    su.clear()
    Submission.objects.all().delete()
    Attachment.objects.all().delete()