# Path: brasilcomvc/portal/models.py
# class HomeBanner(models.Model):
# 
#     image = ProcessedImageField(
#         format='JPEG',
#         options={'quality': 90},
#         processors=[ResizeToFill(2000, 550)],
#         upload_to=homebanner_image_upload_to)
#     video = models.FileField(
#         null=True, blank=True, upload_to=homebanner_video_upload_to)
#     content = models.TextField()
#     created = models.DateTimeField(default=now, editable=False)
# 
#     image.verbose_name = 'imagem'
#     image.help_text = 'Imagem de alta resolução; será cortada para 1400x550.'
#     video.verbose_name = 'vídeo'
#     video.help_text = 'Vídeo curto e leve; ficará em loop.'
#     content.verbose_name = 'conteúdo'
#     content.help_text = 'Conteúdo (HTML) para sobrepor a imagem no banner.'
# 
#     class Meta:
#         verbose_name = 'Banner da Home'
#         verbose_name_plural = 'Banners da Home'
# 
#     def __str__(self):
#         return truncatechars(striptags(self.content), 40)
# 
# def homebanner_image_upload_to(instance, filename):
#     return 'homebanners/{:%Y-%m-%d}/image.jpeg'.format(instance.created)
# 
# def homebanner_video_upload_to(instance, filename):
#     return 'homebanners/{created:%Y-%m-%d}/video{extension}'.format(
#         created=instance.created,
#         extension=filename[filename.rfind('.'):])


from django.test import TestCase
from ..models import (
    HomeBanner,
    homebanner_image_upload_to,
    homebanner_video_upload_to,)



class HomeBannerTestCase(TestCase):

    def test_image_upload_to(self):
        banner = HomeBanner.objects.create()
        self.assertEqual(
            homebanner_image_upload_to(banner, 'whatever.png'),
            'homebanners/{:%Y-%m-%d}/image.jpeg'.format(banner.created))

    def test_video_upload_to(self):

# Path: brasilcomvc/portal/models.py
# class HomeBanner(models.Model):
# 
#     image = ProcessedImageField(
#         format='JPEG',
#         options={'quality': 90},
#         processors=[ResizeToFill(2000, 550)],
#         upload_to=homebanner_image_upload_to)
#     video = models.FileField(
#         null=True, blank=True, upload_to=homebanner_video_upload_to)
#     content = models.TextField()
#     created = models.DateTimeField(default=now, editable=False)
# 
#     image.verbose_name = 'imagem'
#     image.help_text = 'Imagem de alta resolução; será cortada para 1400x550.'
#     video.verbose_name = 'vídeo'
#     video.help_text = 'Vídeo curto e leve; ficará em loop.'
#     content.verbose_name = 'conteúdo'
#     content.help_text = 'Conteúdo (HTML) para sobrepor a imagem no banner.'
# 
#     class Meta:
#         verbose_name = 'Banner da Home'
#         verbose_name_plural = 'Banners da Home'
# 
#     def __str__(self):
#         return truncatechars(striptags(self.content), 40)
# 
# def homebanner_image_upload_to(instance, filename):
#     return 'homebanners/{:%Y-%m-%d}/image.jpeg'.format(instance.created)
# 
# def homebanner_video_upload_to(instance, filename):
#     return 'homebanners/{created:%Y-%m-%d}/video{extension}'.format(
#         created=instance.created,
#         extension=filename[filename.rfind('.'):])


# Path: brasilcomvc/portal/tests/test_models.py
from django.test import TestCase
from ..models import (
    HomeBanner,
    homebanner_image_upload_to,
    homebanner_video_upload_to,)




class HomeBannerTestCase(TestCase):

    def test_image_upload_to(self):
        banner = HomeBanner.objects.create()
        self.assertEqual(
            homebanner_image_upload_to(banner, 'whatever.png'),
            'homebanners/{:%Y-%m-%d}/image.jpeg'.format(banner.created))

    def test_video_upload_to(self):

        banner = HomeBanner.objects.create()