Esempio n. 1
0
    def test_filesystem_crashstorage(self):
        config_manager = self._common_config_setup()
        with config_manager.context() as config:
            crashstorage = FileSystemCrashStorage(config)
            self._common_throttle_test(config, crashstorage)

            crashstorage = FileSystemCrashStorage(config)
            self.assertEqual(list(crashstorage.new_crashes()), [])

            processed_crash = {"name": "Peter", "legacy_processing": 1}
            self.assertRaises(
              CrashIDNotFound,
              crashstorage.save_processed,
              processed_crash
            )
            processed_crash = {"name": "Peter",
                               "uuid": "114559a5-d8e6-428c-8b88-1c1f22120314",
                               }
            crash_id = processed_crash['uuid']
            crashstorage.save_processed(processed_crash)
            returned_processed_crash = crashstorage.get_processed(crash_id)
            self.assertEqual(processed_crash, returned_processed_crash)
            self.assertTrue(isinstance(returned_processed_crash,
                                       DotDict))

            crashstorage.remove(crash_id)
            self.assertRaises(CrashIDNotFound,
                              crashstorage.get_processed,
                              crash_id)
            crashstorage.remove(crash_id)
Esempio n. 2
0
 def _common_config_setup(self):
     mock_logging = Mock()
     required_config = FileSystemCrashStorage.get_required_config()
     required_config.add_option('logger', default=mock_logging)
     config_manager = ConfigurationManager(
         [required_config],
         app_name='testapp',
         app_version='1.0',
         app_description='app description',
         values_source_list=[{
             'logger': mock_logging,
             'std_fs_root': self.std_tmp_dir,
             'def_fs_root': self.def_tmp_dir,
             'pro_fs_root': self.pro_tmp_dir,
         }])
     return config_manager
Esempio n. 3
0
 def _common_config_setup(self):
     mock_logging = Mock()
     required_config = FileSystemCrashStorage.get_required_config()
     required_config.add_option('logger', default=mock_logging)
     config_manager = ConfigurationManager(
       [required_config],
       app_name='testapp',
       app_version='1.0',
       app_description='app description',
       values_source_list=[{
         'logger': mock_logging,
         'std_fs_root': self.std_tmp_dir,
         'def_fs_root': self.def_tmp_dir,
         'pro_fs_root': self.pro_tmp_dir,
       }]
     )
     return config_manager
Esempio n. 4
0
    def test_filesystem_crashstorage(self):
        config_manager = self._common_config_setup()
        with config_manager.context() as config:
            crashstorage = FileSystemCrashStorage(config)
            self._common_throttle_test(config, crashstorage)

            crashstorage = FileSystemCrashStorage(config)
            self.assertEqual(list(crashstorage.new_crashes()), [])

            processed_crash = {"name": "Peter", "legacy_processing": 1}
            self.assertRaises(CrashIDNotFound, crashstorage.save_processed,
                              processed_crash)
            processed_crash = {
                "name": "Peter",
                "uuid": "114559a5-d8e6-428c-8b88-1c1f22120314",
            }
            crash_id = processed_crash['uuid']
            crashstorage.save_processed(processed_crash)
            returned_processed_crash = crashstorage.get_processed(crash_id)
            self.assertEqual(processed_crash, returned_processed_crash)
            self.assertTrue(isinstance(returned_processed_crash, DotDict))

            crashstorage.remove(crash_id)
            self.assertRaises(CrashIDNotFound, crashstorage.get_processed,
                              crash_id)
            crashstorage.remove(crash_id)
Esempio n. 5
0
    def test_filesystem_crashstorage(self):
        config_manager = self._common_config_setup()
        with config_manager.context() as config:
            crashstorage = FileSystemCrashStorage(config)
            self._common_throttle_test(config, crashstorage)

            crashstorage = FileSystemCrashStorage(config)
            eq_(list(crashstorage.new_crashes()), [])

            processed_crash = {"name": "Peter", "legacy_processing": 1}
            assert_raises(
              CrashIDNotFound,
              crashstorage.save_processed,
              processed_crash
            )
            processed_crash = {
                "name": "Peter",
                "uuid": "114559a5-d8e6-428c-8b88-1c1f22120314",
                "email": "*****@*****.**",
            }
            expected_processed_crash = {
                "name": "Peter",
                "uuid": "114559a5-d8e6-428c-8b88-1c1f22120314",
            }
            crash_id = processed_crash['uuid']
            crashstorage.save_processed(processed_crash)
            returned_processed_crash = crashstorage.get_processed(crash_id)
            eq_(
                expected_processed_crash,
                returned_processed_crash
            )
            ok_(isinstance(returned_processed_crash,
                                       DotDict))
            returned_processed_crash = \
                crashstorage.get_unredacted_processed(crash_id)
            eq_(
                processed_crash,
                returned_processed_crash
            )

            crashstorage.remove(crash_id)
            assert_raises(CrashIDNotFound,
                              crashstorage.get_processed,
                              crash_id)
            crashstorage.remove(crash_id)
Esempio n. 6
0
    def test_filesystem_crashstorage(self):
        config_manager = self._common_config_setup()
        with config_manager.context() as config:
            crashstorage = FileSystemCrashStorage(config)
            self._common_throttle_test(config, crashstorage)

            crashstorage = FileSystemCrashStorage(config)
            eq_(list(crashstorage.new_crashes()), [])

            processed_crash = {"name": "Peter", "legacy_processing": 1}
            assert_raises(CrashIDNotFound, crashstorage.save_processed,
                          processed_crash)
            processed_crash = {
                "name": "Peter",
                "uuid": "114559a5-d8e6-428c-8b88-1c1f22120314",
                "email": "*****@*****.**",
            }
            expected_processed_crash = {
                "name": "Peter",
                "uuid": "114559a5-d8e6-428c-8b88-1c1f22120314",
            }
            crash_id = processed_crash['uuid']
            crashstorage.save_processed(processed_crash)
            returned_processed_crash = crashstorage.get_processed(crash_id)
            eq_(expected_processed_crash, returned_processed_crash)
            ok_(isinstance(returned_processed_crash, DotDict))
            returned_processed_crash = \
                crashstorage.get_unredacted_processed(crash_id)
            eq_(processed_crash, returned_processed_crash)

            crashstorage.remove(crash_id)
            assert_raises(CrashIDNotFound, crashstorage.get_processed,
                          crash_id)
            crashstorage.remove(crash_id)