예제 #1
0
 def test_dump_and_restore(self):
     # dump the Gmf generated in setUpClass into a tarfile
     hd = HazardDumper(self.conn)
     hd.dump(self.hc.id)
     tar = hd.mktar()
     curs = self.conn.cursor()
     try:
         # delete the original hazard calculation
         curs.execute("DELETE FROM uiapi.hazard_calculation " "WHERE id=%s", (self.hc.id,))
         # restore the deleted Gmf
         hazard_restore(self.conn, tar)
         curs.execute("SELECT 1 FROM uiapi.hazard_calculation WHERE id=%s", (self.hc.id,))
         self.assertEqual(curs.fetchall(), [(1,)])
     finally:
         os.remove(tar)
예제 #2
0
 def test_dump_and_restore(self):
     # dump the Gmf generated in setUpClass into a directory
     hd = HazardDumper(self.conn)
     hd.dump(self.hc.id)
     curs = self.conn.cursor()
     try:
         # delete the original hazard calculation
         curs.execute('DELETE FROM uiapi.hazard_calculation '
                      'WHERE id=%s', (self.hc.id,))
         # restore the deleted Gmf
         hazard_restore(self.conn, hd.outdir)
         curs.execute('SELECT 1 FROM uiapi.hazard_calculation WHERE id=%s',
                      (self.hc.id,))
         self.assertEqual(curs.fetchall(), [(1,)])
     finally:
         shutil.rmtree(hd.outdir)
예제 #3
0
 def test_dump_and_restore(self):
     # dump the Gmf generated in setUpClass into a directory
     hd = HazardDumper(self.conn)
     hd.dump(self.hc.id)
     curs = self.conn.cursor()
     try:
         # delete the original hazard calculation
         curs.execute('DELETE FROM uiapi.hazard_calculation '
                      'WHERE id=%s', (self.hc.id, ))
         # restore the deleted Gmf
         hazard_restore(self.conn, hd.outdir)
         curs.execute('SELECT 1 FROM uiapi.hazard_calculation WHERE id=%s',
                      (self.hc.id, ))
         self.assertEqual(curs.fetchall(), [(1, )])
     finally:
         shutil.rmtree(hd.outdir)