• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.dummy_context函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中solum.tests.utils.dummy_context函数的典型用法代码示例。如果您正苦于以下问题:Python dummy_context函数的具体用法?Python dummy_context怎么用?Python dummy_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dummy_context函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_upload

    def test_upload(self, mock_write_row, mock_trans_jlog, mock_swift,
                    mock_open):
        ctxt = utils.dummy_context()
        orig_path = "original path"
        assembly = fakes.FakeAssembly()
        build_id = "5678"
        container = 'fake-container'
        cfg.CONF.worker.log_upload_swift_container = container
        stage = "fakestage"

        swiftupload = uploader.SwiftUpload(ctxt, orig_path,
                                           assembly, build_id,
                                           stage)
        resource = swiftupload.resource

        swiftupload.upload_log()

        swift_info = {'container': container}

        filename = "%s-%s/%s-%s.log" % (resource.name,
                                        resource.uuid,
                                        stage, build_id)

        self.assertTrue(mock_trans_jlog.called)
        tansf_path = orig_path + '.tf'
        mock_swift.assert_called_once_with(tansf_path,
                                           container,
                                           filename)
        mock_write_row.assert_called_once_with(filename, swift_info)
开发者ID:pt15,项目名称:solum,代码行数:29,代码来源:test_swift.py


示例2: test_create

    def test_create(self, mock_kc, mock_registry):
        data = {'user_id': 'new_user_id',
                'uuid': 'input_uuid',
                'plan_uuid': 'input_plan_uuid'}

        db_obj = fakes.FakePipeline()
        mock_registry.Pipeline.return_value = db_obj
        fp = fakes.FakePlan()
        mock_registry.Plan.get_by_id.return_value = fp
        fp.raw_content = {
            'name': 'theplan',
            'artifacts': [{'name': 'nodeus',
                           'artifact_type': 'application.heroku',
                           'content': {
                               'href': 'https://example.com/ex.git'},
                           'language_pack': 'auto'}]}
        trust_ctx = utils.dummy_context()
        trust_ctx.trust_id = '12345'
        mock_kc.return_value.create_trust_context.return_value = trust_ctx

        handler = pipeline_handler.PipelineHandler(self.ctx)
        res = handler.create(data)
        db_obj.update.assert_called_once_with(data)
        db_obj.create.assert_called_once_with(self.ctx)
        self.assertEqual(db_obj, res)
        mock_kc.return_value.create_trust_context.assert_called_once_with()
开发者ID:mnegi,项目名称:solum,代码行数:26,代码来源:test_pipeline.py


示例3: setUp

 def setUp(self):
     super(TestWorkflowHandler, self).setUp()
     self.ctx = utils.dummy_context()
     self.CONF = self.useFixture(config.Config())
     self.CONF.config(auth_uri='http://fakeidentity.com',
                      group=auth.OPT_GROUP_NAME)
     self.CONF.config(keystone_version='3')
开发者ID:paperandsoap,项目名称:solum,代码行数:7,代码来源:test_workflow.py


示例4: setUp

    def setUp(self):
        super(TestComponent, self).setUp()
        self.db = self.useFixture(utils.Database())
        self.ctx = utils.dummy_context()
        self.data_assembly = [
            {'project_id': 'project_id_blah',
             'uuid': 'ce43e347f0b0422825245b3e5f140a81cef6e65b',
             'user_id': 'fred',
             'name': 'assembly1',
             'description': 'test assembly',
             'trigger_id': 'trigger-uuid-1234',
             'tags': 'assembly tags',
             'plan_id': 'plan_id_1',
             'status': 'Building',
             'application_uri': 'http://192.168.78.21:5000'}]
        utils.create_models_from_data(assembly.Assembly, self.data_assembly,
                                      self.ctx)

        self.data = [{'project_id': 'project_id_blah',
                      'user_id': 'fred',
                      'uuid': 'ce43e347f0b0422825245b3e5f140a81cef6e65b',
                      'name': 'component_no_assembly',
                      'description': 'test component',
                      'parent_component_id': '87d98s',
                      'tags': 'component tags'},
                     {'project_id': 'project_id_dep',
                      'user_id': 'fred',
                      'uuid': '70763488-72e0-44ac-a612-e94bf5488555',
                      'name': 'component_assembly',
                      'description': 'test component',
                      'assembly_uuid': 'ce43e347f0b042282524'
                                       '5b3e5f140a81cef6e65b',
                      'parent_component_id': '87d98s',
                      'tags': 'component tags'}]
        utils.create_models_from_data(component.Component, self.data, self.ctx)
开发者ID:mnegi,项目名称:solum,代码行数:35,代码来源:test_component.py


示例5: test_create

    def test_create(self, mock_kc, mock_build, mock_registry):
        data = {'user_id': 'new_user_id',
                'uuid': 'input_uuid',
                'plan_uuid': 'input_plan_uuid'}

        db_obj = fakes.FakeAssembly()
        mock_registry.Assembly.return_value = db_obj
        fp = fakes.FakePlan()
        mock_registry.Plan.get_by_id.return_value = fp
        fp.raw_content = {
            'name': 'theplan',
            'artifacts': [{'name': 'nodeus',
                           'artifact_type': 'heroku',
                           'content': {
                               'href': 'https://example.com/ex.git'},
                           'language_pack': 'auto'}]}
        mock_registry.Image.return_value = fakes.FakeImage()
        trust_ctx = utils.dummy_context()
        trust_ctx.trust_id = '12345'
        mock_kc.return_value.create_trust_context.return_value = trust_ctx

        handler = assembly_handler.AssemblyHandler(self.ctx)
        res = handler.create(data)
        db_obj.update.assert_called_once_with(data)
        db_obj.create.assert_called_once_with(self.ctx)
        self.assertEqual(db_obj, res)
        mock_build.assert_called_once_with(
            build_id=8, name='nodeus', assembly_id=8,
            source_uri='https://example.com/ex.git',
            test_cmd=None,
            base_image_id='auto', source_format='heroku', image_format='qcow2')
        mock_kc.return_value.create_trust_context.assert_called_once_with()
开发者ID:paulczar,项目名称:solum,代码行数:32,代码来源:test_assembly.py


示例6: setUp

    def setUp(self):
        super(TestExecution, self).setUp()
        self.db = self.useFixture(utils.Database())
        self.ctx = utils.dummy_context()

        self.data = [{'pipeline_id': 'bla',
                      'uuid': 'ce43e347f0b0422825245b3e5f140a81cef6e65b'}]
        utils.create_models_from_data(execution.Execution, self.data, self.ctx)
开发者ID:BeenzSyed,项目名称:solum,代码行数:8,代码来源:test_execution.py


示例7: test_swift_client_upload_exception

    def test_swift_client_upload_exception(self, mock_file_size,
                                           mock_swift_client, mock_open):

        ctxt = utils.dummy_context()
        mock_file_size.return_value = 0

        swift = swiftclient.SwiftClient(ctxt)
        self.assertRaises(exc.InvalidObjectSizeError,
                          swift.upload, 'filepath', 'fake-container', 'fname')
开发者ID:aneeshep,项目名称:solum,代码行数:9,代码来源:test_solum_swiftclient.py


示例8: setUp

    def setUp(self):
        super(TestPlan, self).setUp()
        self.db = self.useFixture(utils.Database())
        self.ctx = utils.dummy_context()

        self.data = [{'uuid': 'test-uuid-123',
                      'project_id': 'bla',
                      'user_id': 'fred',
                      'raw_content': 'lots of stuff here'}]
        utils.create_models_from_data(plan.Plan, self.data, self.ctx)
开发者ID:alex,项目名称:solum,代码行数:10,代码来源:test_plan.py


示例9: test_upload

    def test_upload(self):
        ctxt = utils.dummy_context()
        orig_path = "original path"
        assembly_id = "1234"
        build_id = "5678"
        baseuploader = uploader.UploaderBase(ctxt, orig_path,
                                             assembly_id, build_id,
                                             "fakestage")

        self.assertEqual(0, baseuploader.write_userlog_row.call_count)
开发者ID:cmer81,项目名称:solum,代码行数:10,代码来源:test_common.py


示例10: setUp

    def setUp(self):
        super(TestCompilerVersions, self).setUp()
        self.db = self.useFixture(utils.Database())
        self.ctx = utils.dummy_context()

        self.data = [{'uuid': '123456789abcdefghi',
                      'version': '1.4',
                      'language_pack_id': 'java1.4'}]

        utils.create_models_from_data(lp.CompilerVersions, self.data, self.ctx)
开发者ID:julienvey,项目名称:solum,代码行数:10,代码来源:test_compiler_versions.py


示例11: setUp

 def setUp(self):
     super(TestImage, self).setUp()
     self.db = self.useFixture(utils.Database())
     self.ctx = utils.dummy_context()
     self.data = [{'project_id': 'test_id',
                   'user_id': 'fred',
                   'uuid': '12345678abcdefgh',
                   'name': 'image1',
                   'description': 'test image'}]
     utils.create_models_from_data(image.Image, self.data, self.ctx)
开发者ID:pravisankar,项目名称:solum,代码行数:10,代码来源:test_image.py


示例12: setUp

 def setUp(self):
     super(TestApp, self).setUp()
     self.db = self.useFixture(utils.Database())
     self.ctx = utils.dummy_context()
     self.data = [{'id': 'test-uuid-555',
                   'project_id': self.ctx.tenant,
                   'user_id': 'fred',
                   'name': 'testapp',
                   'description': 'fake app for testing',
                   }]
     utils.create_models_from_data(app.App, self.data, self.ctx)
开发者ID:aneeshep,项目名称:solum,代码行数:11,代码来源:test_app.py


示例13: setUp

    def setUp(self):
        super(KeystoneClientTest, self).setUp()
        dummy_url = 'http://server.test:5000/v2.0'

        self.ctx = utils.dummy_context()
        self.ctx.auth_url = dummy_url
        self.ctx.auth_token = 'abcd1234'
        self.ctx.auth_token_info = None

        cfg.CONF.set_override('www_authenticate_uri', dummy_url,
                              group='keystone_authtoken')
开发者ID:openstack,项目名称:solum,代码行数:11,代码来源:test_solum_keystoneclient.py


示例14: setUp

    def setUp(self):
        super(TestOSPlatform, self).setUp()
        self.db = self.useFixture(utils.Database())
        self.ctx = utils.dummy_context()

        self.data = [{'uuid': '123456789abcdefghi',
                      'os': 'ubuntu',
                      'version': '12.04',
                      'language_pack_id': 'java1.4'}]

        utils.create_models_from_data(lp.OSPlatform, self.data, self.ctx)
开发者ID:julienvey,项目名称:solum,代码行数:11,代码来源:test_os_platform.py


示例15: setUp

 def setUp(self):
     super(TestService, self).setUp()
     self.db = self.useFixture(utils.Database())
     self.ctx = utils.dummy_context()
     self.data = [{'project_id': 'fake_project_id',
                   'user_id': 'fred',
                   'uuid': '12345678abcdefgh',
                   'name': 'service1',
                   'description': 'test service',
                   'service_type': 'language_pack'}]
     utils.create_models_from_data(service.Service, self.data, self.ctx)
开发者ID:aneeshep,项目名称:solum,代码行数:11,代码来源:test_service.py


示例16: test_upload

    def test_upload(self):
        ctxt = utils.dummy_context()
        orig_path = "original path"
        assembly = fakes.FakeAssembly()
        build_id = "5678"
        localstorage = uploader.LocalStorage(ctxt, orig_path,
                                             assembly, build_id,
                                             "fakestage")
        localstorage.write_userlog_row = mock.MagicMock()
        localstorage.upload()

        localstorage.write_userlog_row.assert_called_once_with(orig_path)
开发者ID:BeenzSyed,项目名称:solum,代码行数:12,代码来源:test_local.py


示例17: setUp

    def setUp(self):
        super(TestComponent, self).setUp()
        self.db = self.useFixture(utils.Database())
        self.ctx = utils.dummy_context()

        self.data = [{'project_id': 'project_id_blah',
                      'user_id': 'fred',
                      'uuid': 'ce43e347f0b0422825245b3e5f140a81cef6e65b',
                      'name': 'component1',
                      'description': 'test component',
                      'tags': 'component tags'}]
        utils.create_models_from_data(component.Component, self.data, self.ctx)
开发者ID:julienvey,项目名称:solum,代码行数:12,代码来源:test_component.py


示例18: setUp

 def setUp(self):
     super(TestPlan, self).setUp()
     self.db = self.useFixture(utils.Database())
     self.ctx = utils.dummy_context()
     raw_content = {'artifacts': [{'content':
                   {'href': 'http://github.com/some/project'}}]}
     self.data = [{'uuid': 'test-uuid-123',
                   'project_id': 'bla',
                   'user_id': 'fred',
                   'description': 'some description',
                   'raw_content': raw_content}]
     utils.create_models_from_data(plan.Plan, self.data, self.ctx)
开发者ID:jamesyli,项目名称:solum,代码行数:12,代码来源:test_plan.py


示例19: setUp

    def setUp(self):
        super(TestAssembly, self).setUp()
        self.db = self.useFixture(utils.Database())
        self.ctx = utils.dummy_context()

        self.data = [{'project_id': 'project_id_blah',
                      'uuid': 'ce43e347f0b0422825245b3e5f140a81cef6e65b',
                      'user_id': 'fred',
                      'name': 'assembly1',
                      'description': 'test assembly',
                      'tags': 'assembly tags',
                      'plan_id': 'plan_id_1'}]
        utils.create_models_from_data(assembly.Assembly, self.data, self.ctx)
开发者ID:julienvey,项目名称:solum,代码行数:13,代码来源:test_assembly.py


示例20: setUp

    def setUp(self):
        super(KeystoneClientTest, self).setUp()
        dummy_url = "http://server.test:5000/v2.0"

        self.ctx = utils.dummy_context()
        self.ctx.auth_url = dummy_url
        self.ctx.auth_token = "abcd1234"
        self.ctx.auth_token_info = None

        cfg.CONF.set_override("auth_uri", dummy_url, group="keystone_authtoken")
        cfg.CONF.set_override("admin_user", "solum", group="keystone_authtoken")
        cfg.CONF.set_override("admin_password", "verybadpass", group="keystone_authtoken")
        cfg.CONF.set_override("admin_tenant_name", "service", group="keystone_authtoken")
开发者ID:vinodpanicker,项目名称:solum,代码行数:13,代码来源:test_solum_keystoneclient.py



注:本文中的solum.tests.utils.dummy_context函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python solution.count_substrings函数代码示例发布时间:2022-05-27
下一篇:
Python log.getLogger函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap