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))
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))
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))