Пример #1
0
 def setUp(self):
     init_consistent_data()
     self.test_project_id = 3
     self.test_user_id = 3
     self.test_project = Project.objects.get(pk=self.test_project_id)
     self.test_user = User.objects.get(pk=self.test_user_id)
     self.client = Client()
Пример #2
0
    def setUpTestData(cls):
        init_consistent_data()
        # Set up data for the whole TestCase
        cls.test_project_id = 3
        cls.test_user_id = 3
        cls.test_project = Project.objects.get(pk=cls.test_project_id)
        cls.test_user = User.objects.get(pk=cls.test_user_id)

        cursor = connection.cursor()
        # Make sure all counters are set correctly
        cursor.execute("""
            SELECT setval('concept_id_seq', coalesce(max("id"), 1), max("id") IS NOT null) FROM concept;
        """)
        cursor.execute("""
            SELECT setval('location_id_seq', coalesce(max("id"), 1), max("id") IS NOT null) FROM location;
        """)

        create_anonymous_user()

        # Assign the new user permissions to browse and annotate projects
        assign_perm('can_browse', cls.test_user, cls.test_project)
        assign_perm('can_annotate', cls.test_user, cls.test_project)

        # Add admin user and test2 users to the test1 group
        g = Group.objects.get(name='test1')
        g.user_set.add(User.objects.get(username='******'))
        g.user_set.add(User.objects.get(username='******'))
        g.save()
Пример #3
0
 def setUp(self):
     init_consistent_data()
     self.test_project_id = 3
     self.test_user_id = 3
     self.test_project = Project.objects.get(pk=self.test_project_id)
     self.test_user = User.objects.get(pk=self.test_user_id)
     self.client = Client()
Пример #4
0
    def setUp(self):
        """ Creates a new test client and test user. The user is assigned
        permissions to modify an existing test project.
        """
        init_consistent_data()
        self.test_project_id = 3
        self.test_user_id = 3
        self.client = Client()

        p = Project.objects.get(pk=self.test_project_id)

        create_anonymous_user(object())

        user = User.objects.get(pk=3)
        # Assign the new user permissions to browse and annotate projects
        assign_perm('can_browse', user, p)
        assign_perm('can_annotate', user, p)
Пример #5
0
    def setUp(self):
        """ Creates a new test client and test user. The user is assigned
        permissions to modify an existing test project.
        """
        init_consistent_data()
        self.test_project_id = 3
        self.test_user_id = 3
        self.client = Client()

        p = Project.objects.get(pk=self.test_project_id)

        create_anonymous_user(object())

        user = User.objects.get(pk=3)
        # Assign the new user permissions to browse and annotate projects
        assign_perm('can_browse', user, p)
        assign_perm('can_annotate', user, p)
Пример #6
0
    def setUpTestData(cls):
        init_consistent_data()
        # Set up data for the whole TestCase
        cls.test_project_id = 3
        cls.test_user_id = 3
        cls.test_project = Project.objects.get(pk=cls.test_project_id)
        cls.test_user = User.objects.get(pk=cls.test_user_id)

        cursor = connection.cursor()
        # Make sure all counters are set correctly
        cursor.execute("""
            SELECT setval('concept_id_seq', coalesce(max("id"), 1), max("id") IS NOT null) FROM concept;
        """)
        cursor.execute("""
            SELECT setval('location_id_seq', coalesce(max("id"), 1), max("id") IS NOT null) FROM location;
        """)

        create_anonymous_user(object())

        # Assign the new user permissions to browse and annotate projects
        assign_perm('can_browse', cls.test_user, cls.test_project)
        assign_perm('can_annotate', cls.test_user, cls.test_project)
Пример #7
0
    def setUp(self):
        """ Creates a new test client and test user. The user is assigned
        permissions to modify an existing test project.
        """
        init_consistent_data()
        self.test_project_id = 3
        self.test_user_id = 3
        self.client = Client()

        p = Project.objects.get(pk=self.test_project_id)

        create_anonymous_user()

        user = User.objects.get(pk=3)
        # Assign the new user permissions to browse and annotate projects
        assign_perm('can_browse', user, p)
        assign_perm('can_annotate', user, p)

        # Add admin user and test2 users to the test1 group
        g = Group.objects.get(name='test1')
        g.user_set.add(User.objects.get(username='******'))
        g.user_set.add(User.objects.get(username='******'))
        g.save()