예제 #1
0
    def testGetRemoteShakeMap(self):
        """Check that we can retrieve both input and output from ftp at once"""
        myShakeEvent = '20110413170148'
        myShakeData = ShakeData(myShakeEvent)

        myExpectedInpFile = os.path.join(shakemapZipDir(),
                                         myShakeEvent + '.inp.zip')
        myExpectedOutFile = os.path.join(shakemapZipDir(),
                                         myShakeEvent + '.out.zip')

        if os.path.exists(myExpectedInpFile):
            os.remove(myExpectedInpFile)
        if os.path.exists(myExpectedOutFile):
            os.remove(myExpectedOutFile)

        myInpFile, myOutFile = myShakeData.fetchEvent()
        myMessage = ('Expected path for downloaded shakemap INP not received'
             '\nExpected: %s\nGot: %s' %
             (myExpectedOutFile, myOutFile))
        self.assertEqual(myInpFile, myExpectedInpFile, myMessage)
        myMessage = ('Expected path for downloaded shakemap OUT not received'
             '\nExpected: %s\nGot: %s' %
             (myExpectedOutFile, myOutFile))
        self.assertEqual(myOutFile, myExpectedOutFile, myMessage)

        assert os.path.exists(myExpectedInpFile)
        assert os.path.exists(myExpectedOutFile)
예제 #2
0
    def testGetRemoteShakeMap(self):
        """Check that we can retrieve both input and output from ftp at once"""
        myShakeEvent = '20110413170148'
        myShakeData = ShakeData(myShakeEvent)

        myExpectedInpFile = os.path.join(shakemapZipDir(),
                                         myShakeEvent + '.inp.zip')
        myExpectedOutFile = os.path.join(shakemapZipDir(),
                                         myShakeEvent + '.out.zip')

        if os.path.exists(myExpectedInpFile):
            os.remove(myExpectedInpFile)
        if os.path.exists(myExpectedOutFile):
            os.remove(myExpectedOutFile)

        myInpFile, myOutFile = myShakeData.fetchEvent()
        myMessage = ('Expected path for downloaded shakemap INP not received'
                     '\nExpected: %s\nGot: %s' %
                     (myExpectedOutFile, myOutFile))
        self.assertEqual(myInpFile, myExpectedInpFile, myMessage)
        myMessage = ('Expected path for downloaded shakemap OUT not received'
                     '\nExpected: %s\nGot: %s' %
                     (myExpectedOutFile, myOutFile))
        self.assertEqual(myOutFile, myExpectedOutFile, myMessage)

        assert os.path.exists(myExpectedInpFile)
        assert os.path.exists(myExpectedOutFile)
예제 #3
0
 def testGetLatestShakeMap(self):
     """Check that we can retrieve the latest shake event"""
     # Simply dont set the event id in the ctor to get the latest
     myShakeData = ShakeData()
     myInpFile, myOutFile = myShakeData.fetchEvent()
     myEventId = myShakeData.eventId
     myExpectedInpFile = os.path.join(shakemapZipDir(),
                                      myEventId + '.inp.zip')
     myExpectedOutFile = os.path.join(shakemapZipDir(),
                                      myEventId + '.out.zip')
     myMessage = ('Expected path for downloaded shakemap INP not received'
          '\nExpected: %s\nGot: %s' %
          (myExpectedOutFile, myOutFile))
     self.assertEqual(myInpFile, myExpectedInpFile, myMessage)
     myMessage = ('Expected path for downloaded shakemap OUT not received'
          '\nExpected: %s\nGot: %s' %
          (myExpectedOutFile, myOutFile))
     self.assertEqual(myOutFile, myExpectedOutFile, myMessage)
예제 #4
0
 def testGetLatestShakeMap(self):
     """Check that we can retrieve the latest shake event"""
     # Simply dont set the event id in the ctor to get the latest
     myShakeData = ShakeData()
     myInpFile, myOutFile = myShakeData.fetchEvent()
     myEventId = myShakeData.eventId
     myExpectedInpFile = os.path.join(shakemapZipDir(),
                                      myEventId + '.inp.zip')
     myExpectedOutFile = os.path.join(shakemapZipDir(),
                                      myEventId + '.out.zip')
     myMessage = ('Expected path for downloaded shakemap INP not received'
                  '\nExpected: %s\nGot: %s' %
                  (myExpectedOutFile, myOutFile))
     self.assertEqual(myInpFile, myExpectedInpFile, myMessage)
     myMessage = ('Expected path for downloaded shakemap OUT not received'
                  '\nExpected: %s\nGot: %s' %
                  (myExpectedOutFile, myOutFile))
     self.assertEqual(myOutFile, myExpectedOutFile, myMessage)