Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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]]
Ejemplo n.º 4
0
    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]]
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
    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.textnode32d = create_textNode('Langweilig2 anders',
                                           authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode32d)
        self.textnode32.add_derivate(self.textnode32d)
        create_vote(self.hans, [self.textnode32, self.textnode32d])
        self.slot3.append_child(self.textnode33)
        self.textnode33d = create_textNode('Langweilig3 anders',
                                           authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode33d)
        self.textnode33.add_derivate(self.textnode33d)
        create_spam_flag(self.hugo, [self.textnode33d])
        create_vote(self.hans, [self.textnode33])
        self.nodes = [self.textnode31, self.textnode32, self.textnode32d,
                      self.textnode33, self.textnode33d]
        self.authorGroups = [[create_user_info(self.hans)],
                             [create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)]]
        self.follows = [0, 1, 1, 1, 0]
        self.spamFlags = [0, 0, 0, 0, 1]
        self.unFollows = [0, 0, 0, 0, 1]
        self.newFollows = [0, 1, 0, 1, 0]
        self.originGroups = [[], [], ['Organisatorisches.2'], [],
                             ['Organisatorisches.4']]
Ejemplo n.º 8
0
    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.textnode32d = create_textNode('Langweilig2 anders',
                                           authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode32d)
        self.textnode32.add_derivate(self.textnode32d)
        create_vote(self.hans, [self.textnode32, self.textnode32d])
        self.slot3.append_child(self.textnode33)
        self.textnode33d = create_textNode('Langweilig3 anders',
                                           authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode33d)
        self.textnode33.add_derivate(self.textnode33d)
        create_spam_flag(self.hugo, [self.textnode33d])
        create_vote(self.hans, [self.textnode33])
        self.nodes = [self.textnode31, self.textnode32, self.textnode32d,
                      self.textnode33, self.textnode33d]
        self.authorGroups = [[create_user_info(self.hans)],
                             [create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)]]
        self.follows = [0, 1, 1, 1, 0]
        self.spamFlags = [0, 0, 0, 0, 1]
        self.unFollows = [0, 0, 0, 0, 1]
        self.newFollows = [0, 1, 0, 1, 0]
        self.originGroups = [[], [], ['Organisatorisches.2'], [],
                             ['Organisatorisches.4']]
Ejemplo n.º 9
0
    def test_append_child_slot_adds_all_paths(self):
        slot = create_slot('Foo')
        self.root.append_child(slot)
        sn1 = create_structureNode("Foobarbaz1")
        slot.append_child(sn1)
        sn2 = create_structureNode("Foobarbaz2")
        slot.append_child(sn2)
        slot_t = create_slot('Ba')
        sn1.append_child(slot_t)
        sn2.append_child(slot_t)

        sn_test = create_structureNode("Barbaren")
        slot_t.append_child(sn_test)

        self.assertEqual(sn_test, PathCache.objects.get(path='Foo.1/Ba.1').node)
        self.assertEqual(sn_test, PathCache.objects.get(path='Foo.2/Ba.1').node)
Ejemplo n.º 10
0
 def setUp(self):
     self.root = get_root_node()
     self.hugo = create_user("Hugo", password="******", groups=['voters'])
     self.ulf = create_user("Ulf", password="******", groups=['voters'])
     self.permela = create_user("Permela", password="******")
     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])
Ejemplo n.º 11
0
 def setUp(self):
     self.root = get_root_node()
     self.hugo = create_user("Hugo", password="******", groups=['voters'])
     self.ulf = create_user("Ulf", password="******", groups=['voters'])
     self.permela = create_user("Permela", password="******")
     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])
Ejemplo n.º 12
0
def fork_node_and_add_slot(path, user, wiki_text):
    source_node = assert_node_for_path(path)
    authors = list(source_node.text.authors.all()) + [user]
    title = source_node.title
    # create fork
    fork = create_structureNode(title,
                                source_node.text.text,
                                authors)
    parent_slot_path = path.rsplit('.', 1)[0]
    parent_slot = get_node_for_path(parent_slot_path)
    parent_slot.append_child(fork)
    fork_path = parent_slot_path + '.' + str(fork.get_index(parent_slot))
    short_titles = set()
    for slot in get_ordered_children_for(source_node):
        fork.append_child(slot)
        short_titles.add(slot.title)
    # create new slot plus node
    schema = parse(wiki_text, 'foo')
    short_title = turn_into_valid_short_title(schema['title'], short_titles)
    new_slot = create_slot(short_title)
    fork.append_child(new_slot)
    node = create_structure_from_structure_node_schema(schema, new_slot, user)
    arg_title = "Abschnitt über '{0}' fehlt.".format(schema['title'])
    source_node.add_derivate(fork, 'con', arg_title, authors=[user])
    # auto follow
    follow_node(fork, user.id)
    follow_node(node, user.id)
    return fork_path
Ejemplo n.º 13
0
def generate_refinement(origin, proposal, argument, slot, user):
    derivate = create_structureNode(long_title=proposal['heading'],
                                    text=proposal['text'],
                                    authors=[user])
    slot.append_child(derivate)

    create_vote(user, [derivate])  # auto-follow

    for child in proposal['subsections']:
        if not re.match(SHORT_TITLE, child['shorttitle']):
            raise InvalidShortTitle('Invalid short-title: "{}"'.format(
                child['shorttitle']))
        if 'text' in child:
            if origin.children.filter(title=child['shorttitle']).count() > 0:
                raise InvalidShortTitle(
                    'ShortTitle {} is already taken'.format(
                        child['shorttitle']))
            child_slot = create_slot(child['shorttitle'])
            derivate.append_child(child_slot)
            generate_proposal_node_with_subsections(child_slot, child, user)
        else:
            child_slots = origin.children.filter(title=child['shorttitle'])
            if child_slots.count() == 0:
                raise InvalidShortTitle('Unknown short title {}'.format(
                    child['shorttitle']))
            derivate.append_child(child_slots[0])
    origin.add_derivate(derivate,
                        arg_type="con",
                        title=argument['heading'],
                        text=argument['text'],
                        authors=[user])
    return derivate
Ejemplo n.º 14
0
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)
Ejemplo n.º 15
0
    def setUp(self):
        self.user_max = create_user("max",password="******")
        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)
Ejemplo n.º 16
0
def generate_refinement(origin, proposal, argument, slot, user):
    derivate = create_structureNode(
        long_title=proposal['heading'], text=proposal['text'], authors=[user])
    slot.append_child(derivate)

    create_vote(user, [derivate])  # auto-follow

    for child in proposal['subsections']:
        if not re.match(SHORT_TITLE, child['shorttitle']):
            raise InvalidShortTitle('Invalid short-title: "{}"'.
                                    format(child['shorttitle']))
        if 'text' in child:
            if origin.children.filter(title=child['shorttitle']).count() > 0:
                raise InvalidShortTitle('ShortTitle {} is already taken'.
                                        format(child['shorttitle']))
            child_slot = create_slot(child['shorttitle'])
            derivate.append_child(child_slot)
            generate_proposal_node_with_subsections(child_slot, child, user)
        else:
            child_slots = origin.children.filter(title=child['shorttitle'])
            if child_slots.count() == 0:
                raise InvalidShortTitle('Unknown short title {}'.
                                        format(child['shorttitle']))
            derivate.append_child(child_slots[0])
    origin.add_derivate(derivate,
                        arg_type="con",
                        title=argument['heading'],
                        text=argument['text'],
                        authors=[user])
    return derivate
Ejemplo n.º 17
0
 def setUp(self):
     self.root = get_root_node()
     self.mustermann = create_user("Mustermann")
     self.slot = create_slot("Flopp")
     self.root.append_child(self.slot)
     self.text1 = create_textNode("Initial Text", "Dumdidum",
                                  [self.mustermann])
     self.slot.append_child(self.text1)
Ejemplo n.º 18
0
    def test_append_child_structure_node_adds_to_path_cache(self):
        slot = create_slot('Foo')
        self.root.append_child(slot)
        sn = create_structureNode("Foobarbaz")
        slot.append_child(sn)

        self.assertEqual(sn, PathCache.objects.get(path='Foo.1').node)
        self.assertEqual('Foo.1', PathCache.objects.get(node=sn).path)
Ejemplo n.º 19
0
    def test_creating_an_argument_adds_to_path_cache(self):
        slot = create_slot('Foo')
        self.root.append_child(slot)
        sn = create_structureNode("Foobarbaz1")
        slot.append_child(sn)

        a = create_argument(sn, arg_type='con')
        node_a = Node.objects.get(id=a.id)
        self.assertEqual(node_a, PathCache.objects.get(path='Foo.1.con.1').node)
Ejemplo n.º 20
0
def create_topic(src_path, topic_name):
        print("Creating '%s' from file '%s'." % (topic_name, src_path))
        root = get_root_node()
        decided = User.objects.get(username="******")
        slot = create_slot(topic_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)
Ejemplo n.º 21
0
def create_topic(src_path, topic_name):
    print("Creating '%s' from file '%s'." % (topic_name, src_path))
    root = get_root_node()
    decided = User.objects.get(username="******")
    slot = create_slot(topic_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)
Ejemplo n.º 22
0
 def setUp(self):
     self.root = get_root_node()
     self.hugo = create_user("Hugo", password="******", groups=['voters'])
     self.slot = create_slot("Slot")
     self.root.append_child(self.slot)
     self.text = create_textNode("Bla",
         "Dieser Text enthält verschiedene Suchbegriffe wie Giraffe, Huhn, Motorrad und Tisch.", [self.hugo])
     self.slot.append_child(self.text)
     self.post1 = create_post("Ich finde /Slot.1 Huhn.", self.hugo)
     self.post1 = create_post("Giraffe Huhn.", self.hugo)
Ejemplo n.º 23
0
 def setUp(self):
     self.root = get_root_node()
     self.hugo = create_user("Hugo", password="******", groups=['voters'])
     self.slot = create_slot("Slot")
     self.root.append_child(self.slot)
     self.text = create_textNode(
         "Bla",
         "Dieser Text enthält verschiedene Suchbegriffe wie Giraffe, Huhn, Motorrad und Tisch.",
         [self.hugo])
     self.slot.append_child(self.text)
     self.post1 = create_post("Ich finde /Slot.1 Huhn.", self.hugo)
     self.post1 = create_post("Giraffe Huhn.", self.hugo)
Ejemplo n.º 24
0
    def setUp(self):
        self.root = get_root_node()
        self.hugo = create_user("Hugo", password="******",
                                groups=['texters', 'voters', 'bloggers'])

        create_user("Notpermitted", password="******")
        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"))
Ejemplo n.º 25
0
 def setUp(self):
     self.root = get_root_node()
     self.mustermann = create_user("Mustermann")
     self.slot = create_slot("Flopp")
     self.root.append_child(self.slot)
     self.text1 = create_textNode("Initial Text", "Dumdidum",
                                  [self.mustermann])
     self.slot.append_child(self.text1)
     self.text2 = create_textNode("Secondary Text", "Dudelda",
                                  [self.mustermann])
     self.slot.append_child(self.text2)
     self.text1.add_derivate(self.text2)
Ejemplo n.º 26
0
    def setUp(self):
        self.horst = create_user('horst')
        self.udo = create_user('udo')

        self.root = get_root_node()
        self.slot1 = create_slot('soon_empty')
        self.root.append_child(self.slot1)
        self.node = create_structureNode('To be or not to be', 'never both')
        self.slot1.append_child(self.node)
        self.arg = create_argument(self.node, 'c', "no", "lyrics")
        self.path = 'soon_empty.1'
        self.child_slot = create_slot('or_to_pee')
        self.node.append_child(self.child_slot)
        self.child = create_structureNode('or to pee')
        self.child_slot.append_child(self.child)

        TextCache.objects.create(path=self.path, paragraphs="doesn't matter")
        IndexCache.objects.create(path=self.path, index_nodes="doesn't matter")

        self.slot2 = create_slot('verfassungswiedrig')
        self.root.append_child(self.slot2)
        self.source = create_structureNode('BöserTitel', 'gewöhnlicher text')
        self.slot2.append_child(self.source)
        self.derivate = create_structureNode('BöserTitel',
                                             'verfassungswiedriger text')
        self.slot2.append_child(self.derivate)
        self.source.add_derivate(self.derivate, arg_type='con',
                                 title="zuSchwach", text="muss fieser werden",
                                 authors=[self.udo])

        self.source_path = 'verfassungswiedrig.1'
        self.derivate_path = 'verfassungswiedrig.2'

        create_vote(self.udo, [self.node])
        create_vote(self.horst, [self.source, self.node])
        create_spam_flag(self.horst, [self.node])

        create_post('i reference /verfassungswiedrig.1 because i like it ',
                    self.horst, self.path)
Ejemplo n.º 27
0
 def setUp(self):
     self.hans = create_user('hans', description='noneSoFar',
                             password="******")
     self.karl = create_user('karl', description='none',
                             password="******")
     self.anon = User.objects.filter(username='******').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])
Ejemplo n.º 28
0
 def setUp(self):
     self.root = get_root_node()
     self.hugo = create_user("Hugo", password="******", groups=['voters'])
     self.permela = create_user("Permela", password="******")
     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='n')
     self.leaf = create_textNode("Bla leaf 1", "Blubb3", [self.hugo])
     self.slot.append_child(self.leaf)
     self.mid.add_derivate(self.leaf, arg_type='n')
Ejemplo n.º 29
0
 def setUp(self):
     self.root = get_root_node()
     self.hugo = create_user("Hugo", password="******", groups=['voters'])
     self.permela = create_user("Permela", password="******")
     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='n')
     self.leaf = create_textNode("Bla leaf 1", "Blubb3", [self.hugo])
     self.slot.append_child(self.leaf)
     self.mid.add_derivate(self.leaf, arg_type='n')
Ejemplo n.º 30
0
def generate_proposal_node_with_subsections(slot, proposal, user):
    proposal_node = create_structureNode(
        long_title=proposal['heading'], text=proposal['text'], authors=[user])
    slot.append_child(proposal_node)
    create_vote(user, [proposal_node])  # auto-follow

    for child in proposal['subsections']:
        if not re.match(SHORT_TITLE, child['shorttitle']):
            raise InvalidShortTitle('Invalid short-title: "{}"'.
                                    format(child['shorttitle']))

        child_slot = create_slot(child['shorttitle'])
        proposal_node.append_child(child_slot)
        generate_proposal_node_with_subsections(child_slot, child, user)

    return proposal_node
Ejemplo n.º 31
0
 def setUp(self):
     self.hugo = create_user('hugo')
     # create nodes
     self.root = get_root_node()
     self.foo = create_slot('foo')
     self.root.append_child(self.foo)
     self.foo1 = create_structureNode('FooooBar')
     self.foo.append_child(self.foo1)
     # add arguments
     self.foo_pro = create_argument(type='pro', text="weils geil ist", authors=[self.hugo])
     self.foo1.append_argument(self.foo_pro)
     self.foo_neut = create_argument(type='neut', text="kann noch geiler werden", authors=[self.hugo])
     self.foo1.append_argument(self.foo_neut)
     self.foo_con = create_argument(type='con', text="is aber leider root", authors=[self.hugo])
     self.foo1.append_argument(self.foo_con)
     # summary variables
     self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con]
Ejemplo n.º 32
0
def generate_proposal_node_with_subsections(slot, proposal, user):
    proposal_node = create_structureNode(long_title=proposal['heading'],
                                         text=proposal['text'],
                                         authors=[user])
    slot.append_child(proposal_node)
    create_vote(user, [proposal_node])  # auto-follow

    for child in proposal['subsections']:
        if not re.match(SHORT_TITLE, child['shorttitle']):
            raise InvalidShortTitle('Invalid short-title: "{}"'.format(
                child['shorttitle']))

        child_slot = create_slot(child['shorttitle'])
        proposal_node.append_child(child_slot)
        generate_proposal_node_with_subsections(child_slot, child, user)

    return proposal_node
Ejemplo n.º 33
0
 def setUp(self):
     self.hugo = create_user('hugo')
     self.hans = create_user('hans')
     # create nodes
     self.root = get_root_node()
     self.foo = create_slot('foo')
     self.foo1 = create_structureNode('FooooBar')
     # add arguments
     self.foo_pro = create_argument(type='pro', title="geil", authors=[self.hugo])
     self.foo1.append_argument(self.foo_pro)
     self.foo_neut = create_argument(type='neut', title="ist", authors=[self.hans])
     self.foo1.append_argument(self.foo_neut)
     self.foo_con = create_argument(type='con', title="geiz", authors=[self.hugo, self.hans])
     self.foo1.append_argument(self.foo_con)
     # summary variables
     self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con]
     self.arg_titles = ['geil', 'ist', 'geiz']
     self.arg_authors = [[self.hugo], [self.hans], [self.hugo, self.hans]]
Ejemplo n.º 34
0
    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]]
Ejemplo n.º 35
0
 def setUp(self):
     self.hans = create_user('hans', description='noneSoFar',
                             password="******")
     self.karl = create_user('karl', description='none',
                             password="******")
     self.anon = User.objects.filter(username='******').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])
Ejemplo n.º 36
0
 def setUp(self):
     self.hugo = create_user('hugo')
     self.hans = create_user('hans')
     # create nodes
     self.root = get_root_node()
     self.foo = create_slot('foo')
     self.root.append_child(self.foo)
     self.foo1 = create_structureNode('FooooBar')
     self.foo.append_child(self.foo1)
     # add arguments
     self.foo_pro = create_argument(self.foo1, arg_type='pro', title="geil",
                                    authors=[self.hugo])
     self.foo_neut = create_argument(self.foo1, arg_type='neut',
                                     title="ist", authors=[self.hans])
     self.foo_con = create_argument(self.foo1, arg_type='con', title="geiz",
                                    authors=[self.hugo, self.hans])
     # summary variables
     self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con]
     self.arg_titles = ['geil', 'ist', 'geiz']
     self.arg_authors = [[self.hugo], [self.hans], [self.hugo, self.hans]]
Ejemplo n.º 37
0
    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]]
Ejemplo n.º 38
0
 def setUp(self):
     self.hugo = create_user('hugo')
     # create nodes
     self.root = get_root_node()
     self.foo = create_slot('foo')
     self.root.append_child(self.foo)
     self.foo1 = create_structureNode('FooooBar')
     self.foo.append_child(self.foo1)
     # add arguments
     self.foo_pro = create_argument(self.foo1,
                                    arg_type='pro',
                                    text="weils geil ist",
                                    authors=[self.hugo])
     self.foo_neut = create_argument(self.foo1,
                                     arg_type='neut',
                                     text="kann noch geiler werden",
                                     authors=[self.hugo])
     self.foo_con = create_argument(self.foo1,
                                    arg_type='con',
                                    text="is aber leider root",
                                    authors=[self.hugo])
     # summary variables
     self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con]
Ejemplo n.º 39
0
    def setUp(self):
        self.root = get_root_node()
        self.hugo = create_user("Hugo", password="******", groups=['voters'])
        self.permela = create_user("Permela", password="******")
        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='n')
        self.leaf1 = create_textNode("Bla leaf 1", "Blubb3", [self.hugo])
        self.slot.append_child(self.leaf1)
        self.mid.add_derivate(self.leaf1, arg_type='n')
        self.mid2 = create_textNode("Bla derivate 2", "Blubb4", [self.hugo])
        self.slot.append_child(self.mid2)
        self.mid.add_derivate(self.mid2, arg_type='n')
        self.leaf2 = create_textNode("Bla leaf 2", "Blubb5", [self.hugo])
        self.slot.append_child(self.leaf2)
        self.mid2.add_derivate(self.leaf2, arg_type='n')
        self.follow = create_vote(self.hugo, [self.text, self.mid, self.leaf1, self.mid2, self.leaf2])

        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(1)
Ejemplo n.º 40
0
    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]]
Ejemplo n.º 41
0
def create_initial_data():
    root = get_root_node()
    decided = create_user("Beschlossenes Programm")
    # create_some_microblogging()

    # Grundsatzprogramm Bundesweit
    # grundsatzprogramm = create_slot("Grundsatzprogramm")
    # root.append_child(grundsatzprogramm)
    # with open("initial_data/grundsatzprogramm_bund.txt", 'r') as f:
    #    gsp_text = f.read()
    # schema = parse(unicode(gsp_text, encoding='utf-8'), grundsatzprogramm.title)
    # create_structure_from_structure_node_schema(schema, grundsatzprogramm, [decided])
    # create_some_microblogging("Grundsatzprogramm.1")

    # Wahlprogramm BTW
    # wahlprogramm_btw = create_slot("Wahlprogramm_BTW")
    # root.append_child(wahlprogramm_btw)
    # with open("initial_data/wahlprogramm_btw.txt", 'r') as f:
    #    wpbtw_text = f.read()
    # schema = parse(unicode(wpbtw_text, encoding='utf-8'), wahlprogramm_btw.title)
    # create_structure_from_structure_node_schema(schema, wahlprogramm_btw, [decided])
    # create_alternatives_for_urheberrecht("Wahlprogramm_BTW.1/Urheberrecht.1")
    # create_some_microblogging("Wahlprogramm_BTW.1/Urheberrecht.1")

    # Positionspapiere Bund
    # posp_bund = create_slot("Positionspapiere")
    # root.append_child(posp_bund)
    # with open("initial_data/positionspapiere_bund.txt", 'r') as f:
    #    pospbund_text = f.read()
    # schema = parse(unicode(pospbund_text, encoding='utf-8'), posp_bund.title)
    # create_structure_from_structure_node_schema(schema, posp_bund, [decided])

    # Wahlprogramm Rheinland-Pfalz
    wahlprogramm_rlp = create_slot("Wahlprogramm_RLP")
    root.append_child(wahlprogramm_rlp)
    with open("initial_data/wahlprogramm_rlp.txt", "r") as f:
        wahlprogrammrlp_text = f.read()
    schema = parse(unicode(wahlprogrammrlp_text, encoding="utf-8"), wahlprogramm_rlp.title)
    create_structure_from_structure_node_schema(schema, wahlprogramm_rlp, [decided])

    # Positionspapiere Rheinland-Pfalz
    posp_rlp = create_slot("Positionspapiere_RLP")
    root.append_child(posp_rlp)
    with open("initial_data/positionspapiere_rlp.txt", "r") as f:
        posprlp_text = f.read()
    schema = parse(unicode(posprlp_text, encoding="utf-8"), posp_rlp.title)
    create_structure_from_structure_node_schema(schema, posp_rlp, [decided])

    # Satzung Rheinland-Pfalz
    satzung_rlp = create_slot("Satzung_RLP")
    root.append_child(satzung_rlp)
    with open("initial_data/satzung_rlp.txt", "r") as f:
        satzungrlp_text = f.read()
    schema = parse(unicode(satzungrlp_text, encoding="utf-8"), satzung_rlp.title)
    create_structure_from_structure_node_schema(schema, satzung_rlp, [decided])

    # Spielwiese
    spielwiese = create_slot("Spielwiese")
    root.append_child(spielwiese)
    with open("initial_data/spielwiese.txt", "r") as f:
        spielwiese_text = f.read()
    schema = parse(unicode(spielwiese_text, encoding="utf-8"), spielwiese.title)
    create_structure_from_structure_node_schema(schema, spielwiese, [decided])
Ejemplo n.º 42
0
    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',
                                                   text="Einleitungstext",
                                                   authors=[self.hans])
        self.slot1.append_child(self.structureNode1)
        self.slot11 = create_slot('Transparenz')
        self.structureNode1.append_child(self.slot11)
        self.structureNode11 = create_structureNode(
            'Traaaansparenz',
            text="Transparenz ist wichtig.",
            authors=[self.hans])
        self.slot11.append_child(self.structureNode11)
        self.slot111 = create_slot('Ebene_3')
        self.structureNode11.append_child(self.slot111)
        self.structureNode111 = create_structureNode('Eeeebeneee 3',
                                                     authors=[self.hans])
        self.slot111.append_child(self.structureNode111)
        self.slot1111 = create_slot('Ebene_4')
        self.structureNode111.append_child(self.slot1111)
        self.structureNode1111 = create_structureNode('Eeeebeneee 4',
                                                      authors=[self.hans])
        self.slot1111.append_child(self.structureNode1111)
        self.slot11111 = create_slot('Ebene_5')
        self.structureNode1111.append_child(self.slot11111)
        self.structureNode11111 = create_structureNode('Eeeebeneee 5',
                                                       authors=[self.hans])
        self.slot11111.append_child(self.structureNode11111)
        self.slot111111 = create_slot('Ebene_6')
        self.structureNode11111.append_child(self.slot111111)
        self.structureNode111111 = create_structureNode('Eeeebeneee 6',
                                                        authors=[self.hans])
        self.slot111111.append_child(self.structureNode111111)
        self.slot1111111 = create_slot('Ebene_7')
        self.structureNode111111.append_child(self.slot1111111)
        self.textnode1111111 = create_textNode('Traaaansparenz',
                                               text="Auf Ebene 7.",
                                               authors=[self.hans])
        self.slot1111111.append_child(self.textnode1111111)
        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',
                                          text="Blubb.",
                                          authors=[self.hans])
        self.slot13.append_child(self.textnode13)
        self.textnode13_a1 = create_argument(self.textnode13,
                                             arg_type='con',
                                             title='Dagegen',
                                             text="...denn ihr seid dafür",
                                             authors=[self.hugo])

        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]]
        self.maxDiff = None
Ejemplo n.º 43
0
 def setUp(self):
     self.root = get_root_node()
     self.hans = create_user('hans')
     self.hugo = create_user('hugo')
     self.foo = create_slot("Foo")
     self.root.append_child(self.foo)
Ejemplo n.º 44
0
 def test_append_child_slot_adds_to_path_cache(self):
     slot = create_slot('Foo')
     self.root.append_child(slot)
     self.assertEqual(slot, PathCache.objects.get(path='Foo').node)
     self.assertEqual('Foo', PathCache.objects.get(node=slot).path)
Ejemplo n.º 45
0
    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',
            text="Einleitungstext",
            authors=[self.hans])
        self.slot1.append_child(self.structureNode1)
        self.slot11 = create_slot('Transparenz')
        self.structureNode1.append_child(self.slot11)
        self.structureNode11 = create_structureNode(
            'Traaaansparenz',
            text="Transparenz ist wichtig.",
            authors=[self.hans])
        self.slot11.append_child(self.structureNode11)
        self.slot111 = create_slot('Ebene_3')
        self.structureNode11.append_child(self.slot111)
        self.structureNode111 = create_structureNode(
            'Eeeebeneee 3',
            authors=[self.hans])
        self.slot111.append_child(self.structureNode111)
        self.slot1111 = create_slot('Ebene_4')
        self.structureNode111.append_child(self.slot1111)
        self.structureNode1111 = create_structureNode(
            'Eeeebeneee 4',
            authors=[self.hans])
        self.slot1111.append_child(self.structureNode1111)
        self.slot11111 = create_slot('Ebene_5')
        self.structureNode1111.append_child(self.slot11111)
        self.structureNode11111 = create_structureNode(
            'Eeeebeneee 5',
            authors=[self.hans])
        self.slot11111.append_child(self.structureNode11111)
        self.slot111111 = create_slot('Ebene_6')
        self.structureNode11111.append_child(self.slot111111)
        self.structureNode111111 = create_structureNode(
            'Eeeebeneee 6',
            authors=[self.hans])
        self.slot111111.append_child(self.structureNode111111)
        self.slot1111111 = create_slot('Ebene_7')
        self.structureNode111111.append_child(self.slot1111111)
        self.textnode1111111 = create_textNode(
            'Traaaansparenz',
            text="Auf Ebene 7.",
            authors=[self.hans])
        self.slot1111111.append_child(self.textnode1111111)
        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', text="Blubb.", authors=[self.hans])
        self.slot13.append_child(self.textnode13)
        self.textnode13_a1 = create_argument(
            self.textnode13, arg_type='con', title='Dagegen',
            text="...denn ihr seid dafür", authors=[self.hugo])

        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]]
        self.maxDiff = None