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

Python mommy.save_one函数代码示例

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

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



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

示例1: test_success_with_nodes

    def test_success_with_nodes(self):
        origin = mommy.save_one(Node)
        destination = mommy.save_one(Node)
        CreateUniqueArcExample(origin, destination)()
        has_arc_cmd = HasArcExample(origin, destination)

        self.assertIsNotNone(has_arc_cmd())
开发者ID:GuidoBR,项目名称:gaegraph,代码行数:7,代码来源:business_tests.py


示例2: test_create_single_arc_for_second_time_error

    def test_create_single_arc_for_second_time_error(self):
        destination = mommy.save_one(Node)
        origin = mommy.save_one(Node)
        cmd = CreateSingleArcExample(origin, destination)
        self.assert_arc_creation(cmd, origin, destination)

        cmd = CreateSingleArcExample(origin, destination)
        self.assertRaises(CommandExecutionException, cmd)
开发者ID:GuidoBR,项目名称:gaegraph,代码行数:8,代码来源:business_tests.py


示例3: test_success

 def test_success(self):
     mommy.save_one(Jogo)
     mommy.save_one(Jogo)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     jogo_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'foto', 'tmp', 'map', 'qtd', 'tit', 'grp']), set(jogo_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:IuryAlves,项目名称:Novos-Bandeirantes,代码行数:9,代码来源:jogo_rest_tests.py


示例4: test_success

 def test_success(self):
     mommy.save_one(User)
     mommy.save_one(User)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     user_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'password']), set(user_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:cicerocasj,项目名称:Catequizando,代码行数:9,代码来源:user_rest_tests.py


示例5: test_only_destination_has_arc

 def test_only_destination_has_arc(self):
     origin = mommy.save_one(Node)
     destination = mommy.save_one(Node)
     another_origin = mommy.save_one(Node)
     arc = CreateArcExample(origin, destination)()
     self.assertEqual(arc.key, HasArcExample(origin=origin)())
     self.assertEqual(arc.key, HasArcExample(destination=destination)())
     self.assertEqual(arc.key, HasArcExample(origin, destination)())
     self.assertIsNone(HasArcExample(another_origin, destination)())
开发者ID:GuidoBR,项目名称:gaegraph,代码行数:9,代码来源:business_tests.py


示例6: test_success

 def test_success(self):
     mommy.save_one(Venda)
     mommy.save_one(Venda)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     venda_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'preco','status']), set(venda_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:renzon,项目名称:appengineepython,代码行数:9,代码来源:venda_rest_tests.py


示例7: test_success

 def test_success(self):
     mommy.save_one(Profile)
     mommy.save_one(Profile)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     profile_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'user', 'tipo']), set(profile_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:cicerocasj,项目名称:Catequizando,代码行数:9,代码来源:profile_rest_tests.py


示例8: test_success

 def test_success(self):
     mommy.save_one(Formacao)
     mommy.save_one(Formacao)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     formacao_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'titulo', 'data', 'conteudo']), set(formacao_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:cicerocasj,项目名称:Catequizando,代码行数:9,代码来源:formacao_rest_tests.py


示例9: test_success

 def test_success(self):
     mommy.save_one(Evento)
     mommy.save_one(Evento)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     evento_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'start', 'end', 'description', 'title']), set(evento_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:cicerocasj,项目名称:Catequizando,代码行数:9,代码来源:evento_rest_tests.py


示例10: test_success

 def test_success(self):
     mommy.save_one(Categoria)
     mommy.save_one(Categoria)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     categoria_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'codigo', 'nome']), set(categoria_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:guilhermegdaf,项目名称:scripts-backend,代码行数:9,代码来源:categoria_rest_tests.py


示例11: test_success

 def test_success(self):
     mommy.save_one(Noticia)
     mommy.save_one(Noticia)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     noticia_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'content', 'link', 'title']), set(noticia_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:cicerocasj,项目名称:Catequizando,代码行数:9,代码来源:noticia_rest_tests.py


示例12: test_success

 def test_success(self):
     mommy.save_one(Membro)
     mommy.save_one(Membro)
     json_response = rest.index()
     context = json_response.context
     self.assertEqual(2, len(context))
     membro_dct = context[0]
     self.assertSetEqual(set(['id', 'creation', 'cargo', 'nome', 'cpf', 'rg', 'telefone', 'endereco', 'data']), set(membro_dct.iterkeys()))
     self.assert_can_serialize_as_json(json_response)
开发者ID:priscilamelosilva,项目名称:Membros,代码行数:9,代码来源:membro_rest_tests.py


示例13: setup_call_stat

 def setup_call_stat(self, LoginClassMock):
     login_obj = Login(None, None, None, None)
     main_user = mommy.save_one(MainUser, email='[email protected]')
     login_obj.result = main_user
     login_obj.set_up = Mock()
     login_obj.do_business = Mock()
     login_obj.commit = lambda: None
     LoginClassMock.return_value = login_obj
     external_user = mommy.save_one(GoogleUser)
     pending_key = PendingExternalToMainUser(external_user=external_user.key, main_user=main_user.key).put()
     return external_user, main_user, pending_key
开发者ID:GuidoBR,项目名称:gaepermission,代码行数:11,代码来源:base_commands2_tests.py


示例14: test_delete

    def test_delete(self):
        model = mommy.save_one(ModelStub)
        self.assertIsNotNone(model.key.get())
        DeleteCommand(model.key).execute()
        self.assertIsNone(model.key.get())

        models = [mommy.save_one(ModelStub) for i in range(3)]
        model_keys = [m.key for m in models]
        self.assertListEqual(models, ndb.get_multi(model_keys))
        DeleteCommand(*model_keys).execute()
        self.assertListEqual([None, None, None], ndb.get_multi(model_keys))
开发者ID:renzon,项目名称:gaebusiness,代码行数:11,代码来源:business_tests.py


示例15: test_create_arc_with_commands

    def test_create_arc_with_commands(self):
        destination = mommy.save_one(Node)
        origin = mommy.save_one(Node)

        cmd = CreateArcExample(NodeSearch(origin), destination)
        self.assert_arc_creation(cmd, origin, destination)

        cmd = CreateArcExample(origin, NodeSearch(destination))
        self.assert_arc_creation(cmd, origin, destination)

        cmd = CreateArcExample(NodeSearch(origin), NodeSearch(destination))
        self.assert_arc_creation(cmd, origin, destination)
开发者ID:GuidoBR,项目名称:gaegraph,代码行数:12,代码来源:business_tests.py


示例16: test_has_arc

    def test_has_arc(self):
        origin = mommy.save_one(Node)
        destination = mommy.save_one(Node)
        arc = CreateArcExample(origin, destination)()
        has_arc_cmd = HasArcExample(origin=origin)

        self.assertEqual(arc.key, has_arc_cmd())
        has_arc_cmd = HasArcExample(destination=destination)

        self.assertEqual(arc.key, has_arc_cmd())
        has_arc_cmd = HasArcExample(origin, destination)

        self.assertEqual(arc.key, has_arc_cmd())
开发者ID:GuidoBR,项目名称:gaegraph,代码行数:13,代码来源:business_tests.py


示例17: test_detail

 def test_detail(self):
     resp = Mock()
     user = permission_facade.save_user_cmd('[email protected]', 'Renzo')()
     site = mommy.save_one(Site, domain='pswdless.appspost.com')
     login = mommy.save_one(Login, status=LOGIN_CLICK, hook='https://pswdless.appspost.com')
     CreateLoginArc(login, user)()
     response = rest.detail(resp,
                            app_id=site.key.id(),
                            token=site.token,
                            ticket=login.key.id())
     status = login.key.get().status
     self.assertEqual(LOGIN_DETAIL, status)
     self.assertNotEqual(400, resp.status_code)
     self.assert_can_serialize_as_json(response)
开发者ID:renzon,项目名称:pswdless,代码行数:14,代码来源:rest_tests.py


示例18: test_another_node_deletion

    def test_another_node_deletion(self):
        not_another_node = mommy.save_one(Node)

        cmd = DeleteNodeExample(not_another_node)
        self.assertRaises(CommandExecutionException, cmd.execute)
        self.assertDictEqual({'node_error': "%s should be AnotherNode instance" % not_another_node.key}, cmd.errors)
        self.assertIsNotNone(not_another_node.key.get())
开发者ID:GuidoBR,项目名称:gaegraph,代码行数:7,代码来源:business_tests.py


示例19: test_delete_node_creating_node_key

 def test_delete_node_creating_node_key(self):
     nodes = [mommy.save_one(NodeStub) for i in range(3)]
     node_keys = [n.key for n in nodes]
     self.assertListEqual(node_keys, DeleteNode(*node_keys).model_keys)
     self.assertListEqual(node_keys, DeleteNode(*[k.id() for k in node_keys]).model_keys)
     self.assertListEqual(node_keys, DeleteNode(*[unicode(k.id()) for k in node_keys]).model_keys)
     self.assertListEqual(node_keys, DeleteNode(*nodes).model_keys)
开发者ID:GuidoBR,项目名称:gaegraph,代码行数:7,代码来源:business_tests.py


示例20: test_admin_group

    def test_admin_group(self):
        @permissions('ADMIN')
        def adm():
            self.executed_adm = True

        user = mommy.save_one(MainUser)
        self.assertFalse(has_permission(user, adm))

        user = mommy.save_one(MainUser, groups=['MANAGER'])
        self.assertFalse(has_permission(user, adm))

        user = mommy.save_one(MainUser, groups=['ADMIN'])
        self.assertTrue(has_permission(user, adm))

        user = mommy.save_one(MainUser, groups=['ADMIN', 'MANAGER'])
        self.assertTrue(has_permission(user, adm))
开发者ID:giovaneliberato,项目名称:gaepermission,代码行数:16,代码来源:decorator_tests.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python momoko.connect函数代码示例发布时间:2022-05-27
下一篇:
Python path.Path类代码示例发布时间: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