コード例 #1
0
ファイル: test_dump.py プロジェクト: hansendx/django-filer
 def setUp(self):
     self.superuser = create_superuser()
     self.img = create_image()
     self.image_name = 'test_file.jpg'
     self.filename = os.path.join(settings.FILE_UPLOAD_TEMP_DIR,
                                  self.image_name)
     self.img.save(self.filename, 'JPEG')
コード例 #2
0
 def setUp(self):
     self.superuser = create_superuser()
     self.client.login(username='******', password='******')
     self.img = create_image()
     self.image_name = 'test_file.jpg'
     self.filename = os.path.join(settings.FILE_UPLOAD_TEMP_DIR,
                                  self.image_name)
     self.img.save(self.filename, 'JPEG')
コード例 #3
0
    def setUp(self):
        self.superuser = create_superuser()
        self.client.login(username='******', password='******')
        self.img = create_image()
        self.image_name = 'test_file.jpg'
        self.filename = os.path.join(settings.FILE_UPLOAD_TEMP_DIR,
                                     self.image_name)
        self.img.save(self.filename, 'JPEG')

        self.file = DjangoFile(open(self.filename, 'rb'), name=self.image_name)
        # This is actually a "file" for filer considerations
        self.image = Image.objects.create(owner=self.superuser,
                                          original_filename=self.image_name,
                                          file=self.file)
        self.clipboard = Clipboard.objects.create(user=self.superuser)
        self.clipboard.append_file(self.image)

        self.folder = Folder.objects.create(name='test_folder')
コード例 #4
0
    def setUp(self):
        try:
            from django.contrib.auth import get_user_model
            User = get_user_model()
        except ImportError:
            from django.contrib.auth.models import User  # NOQA
        self.superuser = create_superuser()
        self.client.login(username='******', password='******')

        self.unauth_user = User.objects.create(username='******')

        self.owner = User.objects.create(username='******')

        self.test_user1 = User.objects.create(username='******',
                                              password='******')
        self.test_user2 = User.objects.create(username='******',
                                              password='******')

        self.group1 = Group.objects.create(name='name1')
        self.group2 = Group.objects.create(name='name2')

        self.test_user1.groups.add(self.group1)
        self.test_user2.groups.add(self.group2)

        self.img = create_image()
        self.image_name = 'test_file.jpg'
        self.filename = os.path.join(settings.FILE_UPLOAD_TEMP_DIR,
                                     self.image_name)
        self.img.save(self.filename, 'JPEG')

        self.file = DjangoFile(open(self.filename, 'rb'), name=self.image_name)
        # This is actually a "file" for filer considerations
        self.image = Image.objects.create(owner=self.superuser,
                                          original_filename=self.image_name,
                                          file=self.file)
        self.clipboard = Clipboard.objects.create(user=self.superuser)
        self.clipboard.append_file(self.image)

        self.folder = Folder.objects.create(name='test_folder')

        self.folder_perm = Folder.objects.create(name='test_folder2')