コード例 #1
0
    def setUp(self):
        self.user = User.objects.create_user("test_student", "*****@*****.**",
                                             "testpassword")
        UserProfile.objects.get_or_create(user=self.user,
                                          gender="M",
                                          is_faculty="ST",
                                          institute="I1",
                                          specialty="S2",
                                          hispanic_latino="Y",
                                          year_of_graduation=2015,
                                          consent_participant=True,
                                          consent_not_participant=False)

        self.hierarchy = Hierarchy(name="main", base_url="/")
        self.hierarchy.save()

        self.root = Section.add_root(label="Root",
                                     slug="",
                                     hierarchy=self.hierarchy)

        self.root.append_child("Section 1", "section-1")
        self.root.append_child("Section 2", "section-2")

        self.section1 = Section.objects.get(slug="section-1")
        self.section2 = Section.objects.get(slug="section-2")
コード例 #2
0
    def setUp(self):
        self.c = Client()
        self.factory = RequestFactory()
        self.user = User.objects.create_user('test_student',
                                             '*****@*****.**',
                                             'testpassword')
        self.user.save()

        self.hierarchy = Hierarchy(name="main", base_url="/")
        self.hierarchy.save()

        root = Section.add_root(label="Root", slug="",
                                hierarchy=self.hierarchy)

        root.append_child("Section 1", "section-1")
        root.append_child("Section 2", "section-2")

        self.section1 = Section.objects.get(slug="section-1")
        self.section2 = Section.objects.get(slug="section-2")