Пример #1
0
    def test_get_remote_shake_map(self):
        """Check that we can retrieve both input and output from ftp at once.
        """
        shake_data = ShakeData(SHAKE_ID)

        expected_input_file = os.path.join(
            shakemap_zip_dir(), SHAKE_ID + '.inp.zip')
        expected_output_file = os.path.join(
            shakemap_zip_dir(), SHAKE_ID + '.out.zip')

        if os.path.exists(expected_input_file):
            os.remove(expected_input_file)
        if os.path.exists(expected_output_file):
            os.remove(expected_output_file)

        input_file, output_file = shake_data.fetch_event()
        message = ('Expected path for downloaded shakemap INP not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(input_file, expected_input_file, message)
        message = ('Expected path for downloaded shakemap OUT not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(output_file, expected_output_file, message)

        self.assertTrue(os.path.exists(expected_input_file))
        self.assertTrue(os.path.exists(expected_output_file))
Пример #2
0
    def test_get_remote_shake_map(self):
        """Check that we can retrieve both input and output from ftp at once.
        """
        shake_event = '20110413170148'
        shake_data = ShakeData(shake_event)

        expected_input_file = os.path.join(shakemap_zip_dir(),
                                           shake_event + '.inp.zip')
        expected_output_file = os.path.join(shakemap_zip_dir(),
                                            shake_event + '.out.zip')

        if os.path.exists(expected_input_file):
            os.remove(expected_input_file)
        if os.path.exists(expected_output_file):
            os.remove(expected_output_file)

        input_file, output_file = shake_data.fetch_event()
        message = ('Expected path for downloaded shakemap INP not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(input_file, expected_input_file, message)
        message = ('Expected path for downloaded shakemap OUT not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(output_file, expected_output_file, message)

        assert os.path.exists(expected_input_file)
        assert os.path.exists(expected_output_file)
Пример #3
0
 def test_get_latest_shake_map(self):
     """Check that we can retrieve the latest shake event."""
     # Simply dont set the event id in the ctor to get the latest
     shake_data = ShakeData()
     input_file, output_file = shake_data.fetch_event()
     event_id = shake_data.event_id
     expected_input_file = os.path.join(shakemap_zip_dir(),
                                        event_id + '.inp.zip')
     expected_output_file = os.path.join(shakemap_zip_dir(),
                                         event_id + '.out.zip')
     message = ('Expected path for downloaded shakemap INP not received'
                '\nExpected: %s\nGot: %s' %
                (expected_output_file, output_file))
     self.assertEqual(input_file, expected_input_file, message)
     message = ('Expected path for downloaded shakemap OUT not received'
                '\nExpected: %s\nGot: %s' %
                (expected_output_file, output_file))
     self.assertEqual(output_file, expected_output_file, message)
Пример #4
0
    def test_get_cached_shake_map(self):
        """Check that we can retrieve both input and output from ftp at once"""
        shake_event = '20120726022003'

        expected_input_file = os.path.join(shakemap_zip_dir(),
                                           shake_event + '.inp.zip')
        expected_output_file = os.path.join(shakemap_zip_dir(),
                                            shake_event + '.out.zip')
        shake_data = ShakeData(shake_event)
        input_file, output_file = shake_data.fetch_event()
        message = ('Expected path for downloaded shakemap INP not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(input_file, expected_input_file, message)
        message = ('Expected path for downloaded shakemap OUT not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(output_file, expected_output_file, message)
Пример #5
0
 def test_get_latest_shake_map(self):
     """Check that we can retrieve the latest shake event."""
     # Simply dont set the event id in the ctor to get the latest
     shake_data = ShakeData()
     input_file, output_file = shake_data.fetch_event()
     event_id = shake_data.event_id
     expected_input_file = os.path.join(shakemap_zip_dir(),
                                        event_id + '.inp.zip')
     expected_output_file = os.path.join(shakemap_zip_dir(),
                                         event_id + '.out.zip')
     message = ('Expected path for downloaded shakemap INP not received'
                '\nExpected: %s\nGot: %s' %
                (expected_output_file, output_file))
     self.assertEqual(input_file, expected_input_file, message)
     message = ('Expected path for downloaded shakemap OUT not received'
                '\nExpected: %s\nGot: %s' %
                (expected_output_file, output_file))
     self.assertEqual(output_file, expected_output_file, message)
Пример #6
0
    def test_get_cached_shake_map(self):
        """Check that we can retrieve both input and output from ftp at once.
        """
        shake_event = '20120726022003'

        expected_input_file = os.path.join(shakemap_zip_dir(),
                                           shake_event + '.inp.zip')
        expected_output_file = os.path.join(shakemap_zip_dir(),
                                            shake_event + '.out.zip')
        shake_data = ShakeData(shake_event)
        input_file, output_file = shake_data.fetch_event()
        message = ('Expected path for downloaded shakemap INP not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(input_file, expected_input_file, message)
        message = ('Expected path for downloaded shakemap OUT not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(output_file, expected_output_file, message)