本文整理汇总了Python中freeseer.framework.config.profile.ProfileManager类的典型用法代码示例。如果您正苦于以下问题:Python ProfileManager类的具体用法?Python ProfileManager怎么用?Python ProfileManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProfileManager类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: recording
def recording(self, request, test_client, monkeypatch, tmpdir):
recording = server.app.blueprints['recording']
monkeypatch.setattr(settings, 'configdir', str(tmpdir.mkdir('configdir')))
test_client.get('/recordings')
profile_manager = ProfileManager(str(tmpdir.mkdir('profile')))
recording.profile = profile_manager.get('testing')
recording.config = recording.profile.get_config('freeseer.conf', settings.FreeseerConfig, ['Global'], read_only=True)
recording.config.videodir = str(tmpdir.mkdir('Videos'))
recording.plugin_manager = PluginManager(recording.profile)
return recording
示例2: TestReportEditorApp
class TestReportEditorApp(unittest.TestCase):
'''
Test cases for ReportEditorApp.
'''
def setUp(self):
'''
Stardard init method: runs before each test_* method
Initializes a QtGui.QApplication and ReportEditorApp object.
ReportEditorApp() causes the UI to be rendered.
'''
self.profile_manager = ProfileManager(tempfile.mkdtemp())
profile = self.profile_manager.get('testing')
config = profile.get_config('freeseer.conf', settings.FreeseerConfig, storage_args=['Global'], read_only=False)
db = profile.get_database()
self.app = QtGui.QApplication([])
self.report_editor = ReportEditorApp(config, db)
self.report_editor.show()
def tearDown(self):
shutil.rmtree(self.profile_manager._base_folder)
del self.app
del self.report_editor.app
def test_close_report_editor(self):
'''
Tests closing the ReportEditorApp
'''
QtTest.QTest.mouseClick(self.report_editor.editorWidget.closeButton, Qt.Qt.LeftButton)
self.assertFalse(self.report_editor.editorWidget.isVisible())
def test_file_menu_quit(self):
'''
Tests ReportEditorApp's File->Quit
'''
self.assertTrue(self.report_editor.isVisible())
# File->Menu
self.report_editor.actionExit.trigger()
self.assertFalse(self.report_editor.isVisible())
def test_help_menu_about(self):
'''
Tests ReportEditorApp's Help->About
'''
self.assertTrue(self.report_editor.isVisible())
# Help->About
self.report_editor.actionAbout.trigger()
self.assertFalse(self.report_editor.hasFocus())
self.assertTrue(self.report_editor.aboutDialog.isVisible())
# Click "Close"
QtTest.QTest.mouseClick(self.report_editor.aboutDialog.closeButton, Qt.Qt.LeftButton)
self.assertFalse(self.report_editor.aboutDialog.isVisible())
示例3: setUp
def setUp(self):
'''
Stardard init method: runs before each test_* method
'''
server.app.config['TESTING'] = True
server.app.storage_file_path = "test_storage_file"
self.app = server.app.test_client()
self.recording = server.app.blueprints['recording']
# token call to fire configuration logic
self.app.get('/recordings')
print self.recording.record_config.videodir
self.profile_manager = ProfileManager(tempfile.mkdtemp())
self.temp_video_dir = tempfile.mkdtemp()
self.recording.record_config.videodir = self.temp_video_dir
self.recording.record_profile = self.profile_manager.get('testing')
self.recording.record_config = self.recording.record_profile.get_config('freeseer.conf', settings.FreeseerConfig, ['Global'], read_only=True)
self.recording.record_plugin_manager = PluginManager(self.recording.record_profile)
self.recording.media_dict = {}
# mock media
self.mock_media_1 = MockMedia()
self.mock_media_2 = MockMedia()
self.test_media_dict_1 = {}
filepath1 = os.path.join(self.recording.record_config.videodir, 'mock_media_1')
filepath2 = os.path.join(self.recording.record_config.videodir, 'mock_media_1')
self.test_media_dict_1[1] = {'media': self.mock_media_1, 'filename': 'mock_media_1', 'filepath': filepath1}
self.test_media_dict_1[2] = {'media': self.mock_media_2, 'filename': 'mock_media_2', 'filepath': filepath2}
示例4: TestConfig
class TestConfig(unittest.TestCase):
def setUp(self):
'''
Stardard init method: runs before each test_* method
Initializes a PluginManager
'''
self.profile_manager = ProfileManager(tempfile.mkdtemp())
self.profile = self.profile_manager.get('testing')
self.config = self.profile.get_config('freeseer.conf',
settings.FreeseerConfig,
['Global'],
read_only=False)
def tearDown(self):
'''
Generic unittest.TestCase.tearDown()
'''
shutil.rmtree(self.profile_manager._base_folder)
def test_save(self):
'''
Tests that the config file was created after being saved.
'''
filepath = self.profile.get_filepath('freeseer.conf')
self.config.save()
self.assertTrue(os.path.exists(filepath))
示例5: setUp
def setUp(self):
self.profile_manager = ProfileManager(tempfile.mkdtemp())
self.temp_video_dir = tempfile.mkdtemp()
profile = self.profile_manager.get('testing')
config = profile.get_config('freeseer.conf', settings.FreeseerConfig, ['Global'], read_only=True)
config.videodir = self.temp_video_dir
plugin_manager = PluginManager(profile)
self.multimedia = Multimedia(config, plugin_manager)
示例6: setUp
def setUp(self):
'''
Stardard init method: runs before each test_* method
Initializes a PluginManager
'''
self.profile_manager = ProfileManager(tempfile.mkdtemp())
profile = self.profile_manager.get('testing')
self.plugman = PluginManager(profile)