예제 #1
0
    def test_upload_mugshot(self):
        """
        Test the uploaded path of mugshots

        TODO: What if a image get's uploaded with no extension?

        """
        user = User.objects.get(pk=1)
        filename = 'my_avatar.png'
        path = upload_to_mugshot(get_user_profile(user=user), filename)

        # Path should be changed from the original
        self.failIfEqual(filename, path)

        # Check if the correct path is returned
        MUGSHOT_RE = re.compile('^%(mugshot_path)s[a-f0-9]{10}.png$' %
                                {'mugshot_path': userena_settings.USERENA_MUGSHOT_PATH})

        self.failUnless(MUGSHOT_RE.search(path))
예제 #2
0
    def test_upload_mugshot(self):
        """
        Test the uploaded path of mugshots

        TODO: What if a image get's uploaded with no extension?

        """
        user = User.objects.get(pk=1)
        filename = 'my_avatar.png'
        path = upload_to_mugshot(get_user_profile(user=user), filename)

        # Path should be changed from the original
        self.failIfEqual(filename, path)

        # Check if the correct path is returned
        MUGSHOT_RE = re.compile(
            '^%(mugshot_path)s[a-f0-9]{10}.png$' %
            {'mugshot_path': userena_settings.USERENA_MUGSHOT_PATH})

        self.failUnless(MUGSHOT_RE.search(path))
예제 #3
0
    def test_upload_mugshot(self):
        """
        Test the uploaded path of mugshots

        TODO: What if a image get's uploaded with no extension?

        """
        user = User.objects.get(pk=1)
        filename = "my_avatar.png"
        path = upload_to_mugshot(get_user_profile(user=user), filename)

        # Path should be changed from the original
        self.assertNotEqual(filename, path)

        # Check if the correct path is returned
        mugshot_re = re.compile(
            r"^%(mugshot_path)s[\w]{10}.png$"
            % {"mugshot_path": userena_settings.USERENA_MUGSHOT_PATH}
        )

        self.assertTrue(mugshot_re.search(path))