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

Python factory.create_user函数代码示例

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

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



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

示例1: setUp

 def setUp(self):
     self.hans = create_user('hans')
     self.herbert = create_user('herbert')
     self.hein = create_user('hein')
     self.hans.profile.blocked.add(self.herbert.profile)
     self.hein.profile.blocked.add(self.herbert.profile)
     self.users = [self.hans, self.herbert, self.hein]
开发者ID:FrankWalle,项目名称:Findeco,代码行数:7,代码来源:test_view_helpers.py


示例2: setUp

 def setUp(self):
     self.root = get_root_node()
     self.hugo = create_user("Hugo", password="1234", groups=['voters'])
     self.ulf = create_user("Ulf", password="abcde", groups=['voters'])
     self.permela = create_user("Permela", password="xxx")
     self.slot = create_slot("Slot")
     self.root.append_child(self.slot)
     self.text = create_textNode("Bla", "Blubb", [self.hugo])
     self.slot.append_child(self.text)
     self.mid = create_textNode("Bla derivate", "Blubb2", [self.hugo])
     self.slot.append_child(self.mid)
     self.text.add_derivate(self.mid, arg_type='c', title="dagegen")
     self.leaf1 = create_textNode("Bla leaf 1", "Blubb3", [self.hugo])
     self.slot.append_child(self.leaf1)
     self.mid.add_derivate(self.leaf1, arg_type='c', title="dagegen2")
     self.mid2 = create_textNode("Bla derivate 2", "Blubb4", [self.hugo])
     self.slot.append_child(self.mid2)
     self.mid.add_derivate(self.mid2, arg_type='c', title="dagegen")
     self.leaf2 = create_textNode("Bla leaf 2", "Blubb5", [self.hugo])
     self.slot.append_child(self.leaf2)
     self.mid2.add_derivate(self.leaf2, arg_type='c', title="dagegen")
     self.follow = create_vote(self.hugo,
                               [self.text, self.mid, self.leaf1, self.mid2,
                                self.leaf2])
     self.arg1 = create_argument(self.text, "con", "Wrong!", "Bad!",
                                 [self.hugo])
开发者ID:justelex,项目名称:Findeco,代码行数:26,代码来源:test_marking.py


示例3: test_mail_notify_new_argument

 def test_mail_notify_new_argument(self):
     hugo = create_user("hugo")
     hugo.email = "[email protected]"
     hugo.profile.wants_mail_notification = True
     hugo.save()
     max = create_user("max")
     max.email = "[email protected]"
     max.profile.wants_mail_notification = True
     max.save()
     berta = create_user("berta")
     berta.email = "[email protected]"
     berta.profile.wants_mail_notification = False
     berta.save()
     post = create_post('System Message', hugo)
     node = create_nodes_for_path('/foo.1', [hugo])
     create_vote(hugo, [node])
     create_vote(max, [node])
     create_vote(berta, [node])
     create_argument(node, 'n', 'Bla', 'Blubb', [hugo])
     notify_new_argument(node, post)
     self.assertEqual(len(mail.outbox), 1)
     m = mail.outbox[0]
     self.assertEqual(m.to, [])
     self.assertEqual(m.bcc, ['[email protected]', '[email protected]'])
     self.assertIn('System Message', m.body)
     self.assertGreater(len(m.subject), 0)
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:26,代码来源:test_view_helpers.py


示例4: setUp

    def setUp(self):
        self.hans = create_user('hans')
        self.hugo = create_user('hugo')

        self.root = get_root_node()
        self.slot1 = create_slot('Wahlprogramm')
        self.root.append_child(self.slot1)
        self.textnode1 = create_textNode('LangerWahlprogrammTitel',
                                         authors=[self.hans])
        self.slot1.append_child(self.textnode1)
        self.slot2 = create_slot('Grundsatzprogramm')
        self.root.append_child(self.slot2)
        self.textnode2 = create_textNode('LangerGrundsatzTitel',
                                         authors=[self.hugo])
        self.slot2.append_child(self.textnode2)
        self.slot3 = create_slot('Organisatorisches')
        self.root.append_child(self.slot3)
        self.textnode31 = create_textNode('Langweilig1', authors=[self.hans])
        self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo])
        self.textnode33 = create_textNode('Langweilig3',
                                          authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode31)
        self.slot3.append_child(self.textnode32)
        self.slot3.append_child(self.textnode33)
        create_vote(self.hans, [self.textnode33])
        self.top_slots = [self.slot1, self.slot2, self.slot3]
        self.short_titles = ['Wahlprogramm', 'Grundsatzprogramm',
                             'Organisatorisches']
        self.full_titles = ['LangerWahlprogrammTitel', 'LangerGrundsatzTitel',
                            'Langweilig3']
        self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]]
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:31,代码来源:test_view_helpers.py


示例5: setUp

    def setUp(self):
        self.hans = create_user('hans')
        self.hugo = create_user('hugo')

        self.root = get_root_node()
        self.slot1 = create_slot('Wahlprogramm')
        self.root.append_child(self.slot1)
        self.structureNode1 = create_structureNode('LangerWahlprogrammTitel',
                                                   authors=[self.hans])
        self.slot1.append_child(self.structureNode1)
        self.slot11 = create_slot('Transparenz')
        self.structureNode1.append_child(self.slot11)
        self.textnode11 = create_textNode('Traaaansparenz', authors=[self.hans])
        self.slot11.append_child(self.textnode11)
        self.slot12 = create_slot('Bildung')
        self.structureNode1.append_child(self.slot12)
        self.textnode12 = create_textNode('Biiildung', authors=[self.hans])
        self.slot12.append_child(self.textnode12)
        self.slot13 = create_slot('Datenschutz')
        self.structureNode1.append_child(self.slot13)
        self.textnode13 = create_textNode('Daaatenschutz', authors=[self.hans])
        self.slot13.append_child(self.textnode13)

        self.arguments = []
        for i in range(1, 25):
            arg = create_argument(self.textnode11, 'p', "Argument" + str(i),
                                  "Text of argument no. " + str(i), [self.hugo, self.hans])
            create_vote(self.hugo, [arg])
            if i % 2 == 1:
                create_vote(self.hans, [arg])
                create_spam_flag(self.hugo, [arg])
            self.arguments.append(arg)
开发者ID:Qwlouse,项目名称:Findeco,代码行数:32,代码来源:test_load_argument_news.py


示例6: test_load_microblogging_for_authored_nodes

    def test_load_microblogging_for_authored_nodes(self):
        hugo = create_user('hugo')
        herbert = create_user('herbert')

        create_nodes_for_path("foo.1", authors=[herbert])
        create_nodes_for_path("foo.2", authors=[hugo])
        create_nodes_for_path("foo.1/bar.1", authors=[hugo, herbert])

        posts = [create_post("posted at node", hugo, location='foo.2'),
                 create_post("reference /foo.2", hugo, location=''),
                 create_post("reference /foo.1/bar.1", hugo, location='foo.2')]

        wrong_posts = [create_post("posted somewhere", hugo, location='foo.1'),
                       create_post("reference wrong /foo.1", hugo, location=''),
                       create_post("neither", hugo, location='')]

        response = self.client.get(
            reverse('load_microblogging_for_authored_nodes',
                    kwargs={'name': 'hugo'}))
        res = json.loads(response.content)["loadMicrobloggingResponse"]

        response_id_list = [m["microblogID"] for m in res]
        for post in posts:
            self.assertIn(post.id, response_id_list)
        for post in wrong_posts:
            self.assertNotIn(post.id, response_id_list)
        self.assertEqual(len(res), 3)
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:27,代码来源:test_views.py


示例7: setUp

    def setUp(self):
        self.root = get_root_node()
        self.hugo = create_user("Hugo", password="1234",
                                groups=['texters', 'voters', 'bloggers'])

        create_user("Notpermitted", password="fghjfgh")
        self.slot = create_slot("Slot")
        self.root.append_child(self.slot)
        self.text = create_textNode("Slotteria", "This is a textnode",
                                    authors=[self.hugo])
        self.slot.append_child(self.text)
        self.url = reverse('store_text', kwargs=dict(path="Slot.1"))
开发者ID:justelex,项目名称:Findeco,代码行数:12,代码来源:test_store_text.py


示例8: test_change_microblogging_authorship_updates_template_text

    def test_change_microblogging_authorship_updates_template_text(self):
        hugo = create_user('hugo')
        create_user('herbert')
        arno = create_user('arno')

        post = create_post('hallo @hugo ich bins @herbert!', hugo)
        post.save()
        self.assertEqual(post.text_template, 'hallo {u0} ich bins {u1}!')
        change_microblogging_authorship(hugo, arno)
        post = Post.objects.get(id=post.id)  # update object from DB

        self.assertEqual(post.text_template, 'hallo {u1} ich bins {u0}!')
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:12,代码来源:test_tools.py


示例9: test_change_microblogging_authorship_updates_mentions

    def test_change_microblogging_authorship_updates_mentions(self):
        hugo = create_user('hugo')
        create_user('herbert')
        arno = create_user('arno')

        post = create_post('hallo @hugo ich bins @herbert!', hugo)
        post.save()

        change_microblogging_authorship(hugo, arno)
        post = Post.objects.get(id=post.id)  # update object from DB

        self.assertNotIn(hugo, post.mentions.all())
        self.assertIn(arno, post.mentions.all())
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:13,代码来源:test_tools.py


示例10: test_load_microblogging_all_loads_all_microblogging

    def test_load_microblogging_all_loads_all_microblogging(self):
        hugo = create_user("hugo")
        herbert = create_user("herbert")
        create_nodes_for_path("foo.1")
        posts = [create_post("text", hugo, location=''),
                 create_post("text3", hugo, location='foo.1'),
                 create_post("text2", herbert, location='foo.1')]
        response = self.client.get(reverse('load_microblogging_all'))
        res = json.loads(response.content)["loadMicrobloggingResponse"]

        ids = [m["microblogID"] for m in res]
        for p in posts:
            self.assertIn(p.id, ids)
        self.assertEqual(len(res), 3)
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:14,代码来源:test_views.py


示例11: setUp

 def setUp(self):
     self.hans = create_user('hans', description='noneSoFar',
                             password="1234")
     self.karl = create_user('karl', description='none',
                             password="blubb")
     self.anon = User.objects.filter(username='anonymous').all()[0]
     self.slot = create_slot("test")
     self.text1 = create_textNode("Hans Text", "Ich werde anonymisiert", [self.hans])
     self.text2 = create_textNode("Karls Text", "Ich werde nicht anonymisiert", [self.karl])
     self.text3 = create_textNode("Gemeinsamer Text", "Anonymous wird dabei geholfen haben diesen Text zu erstellen",
                                  [self.hans, self.karl])
     self.text4 = create_textNode("Gemeinsamer Text mit anonymous",
                                  "Anonymous wird dabei geholfen haben diesen Text zu erstellen",
                                  [self.hans, self.karl, self.anon])
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:14,代码来源:test_user_api.py


示例12: test_change_microblogging_authorship_can_deal_with_duplications

    def test_change_microblogging_authorship_can_deal_with_duplications(self):
        hugo = create_user('hugo')
        herbert = create_user('herbert')

        post = create_post('hallo @hugo ich bins @herbert!', hugo)
        post.save()
        self.assertEqual(post.text_template, 'hallo {u0} ich bins {u1}!')
        change_microblogging_authorship(hugo, herbert)
        post = Post.objects.get(id=post.id)  # update object from DB

        self.assertNotIn(hugo, post.mentions.all())
        self.assertIn(herbert, post.mentions.all())

        self.assertEqual(post.text_template, 'hallo {u0} ich bins {u0}!')
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:14,代码来源:test_tools.py


示例13: create_some_microblogging

def create_some_microblogging(path=None):
    if User.objects.filter(username="Blogger 1").count() > 0:
        blogger1 = User.objects.filter(username="Blogger 1").all()[0]
    else:
        blogger1 = create_user("Blogger 1")
    create_post(
        "Meine Oma fährt im Hühnerstall Motorrad!" if not path else "Meine Oma erwähnt /" + path + " im Hühnerstall.",
        blogger1,
    )
    if User.objects.filter(username="Troll").count() > 0:
        troll = User.objects.filter(username="Troll").all()[0]
    else:
        troll = create_user("Troll")
    if path:
        create_post("Ich erwähne /" + path + " um zu trollen. Lies das was ich schreibe und ärgere dich!", troll)
开发者ID:justelex,项目名称:Findeco,代码行数:15,代码来源:initial_data.py


示例14: test_recovery_resolve

 def test_recovery_resolve(self):
     hans = create_user('hans', password="forgotten")
     act = PasswordRecovery.create(hans)
     pw = act.resolve()
     self.assertTrue(pw)
     self.assertIsNone(authenticate(username='hans', password='forgotten'))
     self.assertEqual(authenticate(username='hans', password=pw), hans)
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:7,代码来源:test_activation_models.py


示例15: setUp

    def setUp(self):
        self.hugo = create_user('hugo')
        self.herbert = create_user('herbert')

        self.foo1 = create_nodes_for_path('foo.1')
        self.foo1bar1 = create_nodes_for_path('foo.1/bar.1')

        self.schema_skeleton = {
            'author': self.hugo.id,
            'location': self.foo1.id,
            'type': "userpost",
            'template_text': "some text",
            'mentions': [],
            'references': [],
            'answer_to': None
        }
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:16,代码来源:test_post.py


示例16: create_initial_data

def create_initial_data():
    root = get_root_node()
    decided = create_user("Beschluss_Programm",
                          description="Diese Vorschläge wurden in ihrer urspünglichen "
                                      "Fassung schon von einem Parteitag beschlossen. "
                                      "Weiterentwicklungen dieser Vorschläge sind "
                                      "natürlich kein beschlossenes Programm.",
                          groups=['texters', 'voters', 'bloggers'])

    with open(project_path("initial_data/root.txt"), 'r') as f:
        lines = f.readlines()
        for l in lines:
            if comment_line_pattern.match(l):
                continue

            slot_name, src_file = l.split()
            assert re.match('^' + SHORT_TITLE + '$', slot_name), \
                "Invalid short title '%s'." % slot_name

            src_path = project_path(os.path.join('initial_data', src_file))
            assert os.path.exists(src_path), \
                "Source file not found: '%s'." % src_path

            print("Creating '%s' from file '%s'." % (slot_name, src_path))
            slot = create_slot(slot_name)
            root.append_child(slot)
            with open(src_path, 'r') as src:
                schema = parse(unicode(src.read(), encoding='utf-8'), slot.title)
                create_structure_from_structure_node_schema(schema, slot, decided)
开发者ID:Qwlouse,项目名称:Findeco,代码行数:29,代码来源:initial_data.py


示例17: setUp

    def setUp(self):
        self.user_max = create_user("max",password="1234")
        self.user_maria = create_user("Maria")

        root = backend.get_root_node()
        slot1 = create_slot("Bla")
        root.append_child(slot1)

        self.text_node1 = create_textNode("Whatever","Testtext",[self.user_max])
        slot1.append_child(self.text_node1)

        slot2 = create_slot("Blubb")
        root.append_child(slot2)

        text_node2 = create_textNode("Whatever2","Testtext Nummer 2",[self.user_max])
        slot2.append_child(text_node2)
开发者ID:FrankWalle,项目名称:Findeco,代码行数:16,代码来源:tests.py


示例18: setUp

 def setUp(self):
     self.max = create_user('max')
     self.root = get_root_node()
     self.bla = create_slot("Bla")
     self.root.append_child(self.bla)
     self.bla1 = create_structureNode('Bla ist Bla',
                                      "Das musste gesagt werden.",
                                      [self.max])
     self.bla.append_child(self.bla1)
     self.blubb = create_slot("Blubb")
     self.bla1.append_child(self.blubb)
     self.blubb1 = create_textNode("Blubb ist eins", "Gesagt ist gedacht.",
                                   [self.max])
     self.blubb.append_child(self.blubb1)
     self.blubb2 = create_textNode("Blubb die Zweite",
                                   "Geschrieben ist notiert.", [self.max])
     self.blubb.append_child(self.blubb2)
     self.blubb2d = create_textNode("Blubb die Zweite",
                                    "Geschrieben ist anders notiert.",
                                    [self.max])
     self.blubb.append_child(self.blubb2d)
     self.blubb2.add_derivate(self.blubb2d)
     self.bla2 = create_textNode("Follopp", "Globbern!", [self.max])
     self.bla.append_child(self.bla2)
     self.bla2.add_derivate(self.blubb2)
     self.bla3 = create_textNode("Folloppiii", "Globbern! Den ganzen Tag.",
                                 [self.max])
     self.bla.append_child(self.bla3)
     self.blubb2.add_derivate(self.bla3)
     self.bla4 = create_textNode("Flop", "Glob!", [self.max])
     self.bla.append_child(self.bla4)
     self.bla3.add_derivate(self.bla4)
开发者ID:justelex,项目名称:Findeco,代码行数:32,代码来源:test_load_graph_data.py


示例19: test_delete_posts_referring_to_removes_referring_posts1

 def test_delete_posts_referring_to_removes_referring_posts1(self):
     hugo = create_user('hugo')
     node = create_nodes_for_path("path.1")
     create_post("foo", hugo, '/path.1')
     self.assertEqual(Post.objects.count(), 1)
     delete_posts_referring_to(node)
     self.assertEqual(Post.objects.count(), 0)
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:7,代码来源:test_tools.py


示例20: setUp

    def setUp(self):
        self.hans = create_user('hans')
        self.hugo = create_user('hugo')

        self.root = get_root_node()
        self.slot1 = create_slot('Wahlprogramm')
        self.root.append_child(self.slot1)
        self.structureNode1 = create_structureNode('LangerWahlprogrammTitel',
                                                   authors=[self.hans])
        self.slot1.append_child(self.structureNode1)
        self.slot11 = create_slot('Transparenz')
        self.structureNode1.append_child(self.slot11)
        self.textnode11 = create_textNode('Traaaansparenz', authors=[self.hans])
        self.slot11.append_child(self.textnode11)
        self.slot12 = create_slot('Bildung')
        self.structureNode1.append_child(self.slot12)
        self.textnode12 = create_textNode('Biiildung', authors=[self.hans])
        self.slot12.append_child(self.textnode12)
        self.slot13 = create_slot('Datenschutz')
        self.structureNode1.append_child(self.slot13)
        self.textnode13 = create_textNode('Daaatenschutz', authors=[self.hans])
        self.slot13.append_child(self.textnode13)

        self.slot2 = create_slot('Grundsatzprogramm')
        self.root.append_child(self.slot2)
        self.textnode2 = create_textNode('LangerGrundsatzTitel',
                                         authors=[self.hugo])
        self.slot2.append_child(self.textnode2)

        self.slot3 = create_slot('Organisatorisches')
        self.root.append_child(self.slot3)
        self.textnode31 = create_textNode('Langweilig1', authors=[self.hans])
        self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo])
        self.textnode33 = create_textNode('Langweilig3',
                                          authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode31)
        self.slot3.append_child(self.textnode32)
        self.slot3.append_child(self.textnode33)
        create_vote(self.hans, [self.textnode33])

        self.top_slots = [self.slot1, self.slot2, self.slot3]
        self.child_slots = [self.slot11, self.slot12, self.slot13]
        self.short_titles = ['Wahlprogramm', 'Grundsatzprogramm',
                             'Organisatorisches']
        self.full_titles = ['LangerWahlprogrammTitel', 'LangerGrundsatzTitel',
                            'Langweilig3']
        self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]]
开发者ID:Lhurgoyfina,项目名称:Findeco,代码行数:47,代码来源:test_load_node.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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