Esempio n. 1
0
 def test_saveResponse(self):
     """
     Fetches and stores response information as Dataless SEED volume.
     """
     tempfile = NamedTemporaryFile().name
     try:
         client = Client()
         start = UTCDateTime(2008, 1, 1)
         end = start + 1
         # Dataless SEED
         client.saveResponse(tempfile, 'BW', 'MANZ', '', 'EHZ', start, end)
         self.assertEquals(open(tempfile).read(8), "000001V ")
     finally:
         os.remove(tempfile)
Esempio n. 2
0
    def test_saveResponse(self):
        """
        Fetches and stores response information as Dataless SEED volume.
        """
        client = Client(user='******')
        start = UTCDateTime(2008, 1, 1)
        end = start + 1
        with NamedTemporaryFile() as tf:
            tempfile = tf.name
            # Dataless SEED
            client.saveResponse(tempfile, 'BW', 'MANZ', '', 'EHZ', start, end)
            self.assertEqual(open(tempfile).read(8), "000001V ")

        # Try again but write to a StringIO instance.
        file_object = StringIO.StringIO()
        client = Client(user='******')
        start = UTCDateTime(2008, 1, 1)
        end = start + 1
        # Dataless SEED
        client.saveResponse(file_object, 'BW', 'MANZ', '', 'EHZ', start, end)
        file_object.seek(0, 0)
        self.assertEqual(file_object.read(8), "000001V ")