Esempio n. 1
0
    def test_happy_path(self):
        """
        Read files and verify that all expected particles can be read.
        Verify that the contents of the particles are correct.
        There should be no exceptions generated.
        """
        log.debug('===== START TEST HAPPY PATH =====')

        with open(os.path.join(RESOURCE_PATH, 'ctdmo01_20140712_120719.DAT'), 'r') as file_handle:
            parser = CtdmoGhqrImodemParser(self._telemetered_config, file_handle, self.exception_callback)

            particles = parser.get_records(1000)

            self.assertEqual(self.exception_callback_value, [])

            self.particle_to_yml(particles, 'ctdmo01_20140712_120719_telem.yml')

            self.assert_particles(particles, "ctdmo01_20140712_120719_telem.yml", RESOURCE_PATH)

        with open(os.path.join(RESOURCE_PATH, 'ctdmo01_20140712_120719.DAT'), 'r') as file_handle:
            parser = CtdmoGhqrImodemParser(self._recovered_config, file_handle, self.exception_callback)

            particles = parser.get_records(1000)

            self.assertEqual(self.exception_callback_value, [])

            self.particle_to_yml(particles, 'ctdmo01_20140712_120719_recov.yml')

            self.assert_particles(particles, "ctdmo01_20140712_120719_recov.yml", RESOURCE_PATH)

        self.assertEqual(self.exception_callback_value, [])

        log.debug('===== END TEST HAPPY PATH =====')
    def test_happy_path(self):
        """
        Read files and verify that all expected particles can be read.
        Verify that the contents of the particles are correct.
        There should be no exceptions generated.
        """
        log.debug('===== START TEST HAPPY PATH =====')

        with open(os.path.join(RESOURCE_PATH, 'ctdmo01_20140712_120719.DAT'),
                  'r') as file_handle:
            parser = CtdmoGhqrImodemParser(self._telemetered_config,
                                           file_handle,
                                           self.exception_callback)

            particles = parser.get_records(1000)

            self.assertEqual(self.exception_callback_value, [])

            self.particle_to_yml(particles,
                                 'ctdmo01_20140712_120719_telem.yml')

            self.assert_particles(particles,
                                  "ctdmo01_20140712_120719_telem.yml",
                                  RESOURCE_PATH)

        with open(os.path.join(RESOURCE_PATH, 'ctdmo01_20140712_120719.DAT'),
                  'r') as file_handle:
            parser = CtdmoGhqrImodemParser(self._recovered_config, file_handle,
                                           self.exception_callback)

            particles = parser.get_records(1000)

            self.assertEqual(self.exception_callback_value, [])

            self.particle_to_yml(particles,
                                 'ctdmo01_20140712_120719_recov.yml')

            self.assert_particles(particles,
                                  "ctdmo01_20140712_120719_recov.yml",
                                  RESOURCE_PATH)

        self.assertEqual(self.exception_callback_value, [])

        log.debug('===== END TEST HAPPY PATH =====')
Esempio n. 3
0
    def test_unexpected_data(self):
        """
        This test verifies that an unexpected data exception is reported when unexpected data
        is found.
        """
        log.debug('===== START TEST UNEXPECTED DATA =====')

        with open(os.path.join(RESOURCE_PATH, 'unexpected_data.DAT'), 'r') as file_handle:

            parser = CtdmoGhqrImodemParser(self._telemetered_config, file_handle, self.exception_callback)

            parser.get_records(1)

            self.assertEqual(len(self.exception_callback_value), 2)

            for exception in self.exception_callback_value:
                self.assertIsInstance(exception, UnexpectedDataException)

        log.debug('===== END TEST UNEXPECTED DATA =====')
    def test_unexpected_data(self):
        """
        This test verifies that an unexpected data exception is reported when unexpected data
        is found.
        """
        log.debug('===== START TEST UNEXPECTED DATA =====')

        with open(os.path.join(RESOURCE_PATH, 'unexpected_data.DAT'),
                  'r') as file_handle:

            parser = CtdmoGhqrImodemParser(self._telemetered_config,
                                           file_handle,
                                           self.exception_callback)

            parser.get_records(1)

            self.assertEqual(len(self.exception_callback_value), 2)

            for exception in self.exception_callback_value:
                self.assertIsInstance(exception, UnexpectedDataException)

        log.debug('===== END TEST UNEXPECTED DATA =====')