# Path: advertisements/models.py
# class Provider(models.Model):
# class AdvertisementPanel(models.Model):
# class Advertisement(models.Model):
# class Click(models.Model):
#     def __unicode__(self):
#     def active_ads(self):
#     def active_ads_list(self):
#     def inactive_ads(self):
#     def total_clicks(self):
#     def get_absolute_url(self):
# def get_file_path(instance, filename):
#     def ad_display_num(self):
#     def total_width(self):
#     def total_height(self):
#     def get_adverts(self):
#     def get_absolute_url(self):
#     def get_iframe_url(self):
#     def __unicode__(self):
#     def __unicode__(self):
#     def clicked(self):
#     def click_history(self, history_days=10):
#     def get_absolute_url(self):
#     def get_signed_link(self):
#     def total_clicks(self):
#     ACTIVE = 'a'
#     INACTIVE = 'i'
#     PENDING = 'p'
#     STATUS_CHOICES = (
#         (ACTIVE, 'Active'),
#         (INACTIVE, 'Inactive'),
#         (PENDING, 'Pending'),
#     )


from django.test import TestCase
from advertisements.models import User, Provider, Advertisement
from django.core.urlresolvers import reverse
from model_mommy import mommy
        )

        self.assertEqual(response.status_code, 200)

    def test_can_view_any_ad_statistics(self):
        """
        Test that an admin can view their own ad statistics
        """

        for advert in self.provider_adverts:
            response = self.client.get(reverse('provider:advert_statistics', args=[advert.pk]))

            self.assertEqual(response.status_code, 200)
            self.assertIn('advert', response.context)
            self.assertEqual(response.context['advert'], advert)

        # Provider attached to user
        attached_provider = mommy.make(Provider, user=self.user)
        attached_adverts = mommy.make(Advertisement, provider=attached_provider, _quantity=10)

        for advert in attached_adverts:
            response = self.client.get(reverse('provider:advert_statistics', args=[advert.pk]))

            self.assertEqual(response.status_code, 200)
            self.assertIn('advert', response.context)
            self.assertEqual(response.context['advert'], advert)


class UserViewTests(TestCase):
    def setUp(self):

# Path: advertisements/models.py
# class Provider(models.Model):
# class AdvertisementPanel(models.Model):
# class Advertisement(models.Model):
# class Click(models.Model):
#     def __unicode__(self):
#     def active_ads(self):
#     def active_ads_list(self):
#     def inactive_ads(self):
#     def total_clicks(self):
#     def get_absolute_url(self):
# def get_file_path(instance, filename):
#     def ad_display_num(self):
#     def total_width(self):
#     def total_height(self):
#     def get_adverts(self):
#     def get_absolute_url(self):
#     def get_iframe_url(self):
#     def __unicode__(self):
#     def __unicode__(self):
#     def clicked(self):
#     def click_history(self, history_days=10):
#     def get_absolute_url(self):
#     def get_signed_link(self):
#     def total_clicks(self):
#     ACTIVE = 'a'
#     INACTIVE = 'i'
#     PENDING = 'p'
#     STATUS_CHOICES = (
#         (ACTIVE, 'Active'),
#         (INACTIVE, 'Inactive'),
#         (PENDING, 'Pending'),
#     )


# Path: advertisements/tests/test_views.py
from django.test import TestCase
from advertisements.models import User, Provider, Advertisement
from django.core.urlresolvers import reverse
from model_mommy import mommy

        )

        self.assertEqual(response.status_code, 200)

    def test_can_view_any_ad_statistics(self):
        """
        Test that an admin can view their own ad statistics
        """

        for advert in self.provider_adverts:
            response = self.client.get(reverse('provider:advert_statistics', args=[advert.pk]))

            self.assertEqual(response.status_code, 200)
            self.assertIn('advert', response.context)
            self.assertEqual(response.context['advert'], advert)

        # Provider attached to user
        attached_provider = mommy.make(Provider, user=self.user)
        attached_adverts = mommy.make(Advertisement, provider=attached_provider, _quantity=10)

        for advert in attached_adverts:
            response = self.client.get(reverse('provider:advert_statistics', args=[advert.pk]))

            self.assertEqual(response.status_code, 200)
            self.assertIn('advert', response.context)
            self.assertEqual(response.context['advert'], advert)


class UserViewTests(TestCase):
    def setUp(self):

        self.user = User.objects.create_user('user', 'test@example.com', 'pass')