# Path: api_v3/factories/profile.py
# class ProfileFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Profile
# 
#     email = Faker('email')
#     first_name = Faker('first_name')
#     last_name = Faker('last_name')
#     bio = Faker('job')
#     last_login = Faker('past_date', start_date='-30d')
# 
# Path: api_v3/factories/review.py
# class ReviewFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Review
# 
#     ticket = SubFactory(TicketFactory)
#     body = Faker('bs')
# 
# Path: api_v3/tests/views/support.py
# class ApiTestCase(TestCase):
#     JSON_API_CONTENT_TYPE = 'application/vnd.api+json'
#     def as_jsonapi_payload(self, serializer_class, obj, update={}):


from api_v3.factories import ProfileFactory, ReviewFactory
from .support import TestCase, APIClient, reverse
# -*- coding: utf-8 -*-


class ExpenseExportsEndpointTestCase(TestCase):
    def setUp(self):
        self.client = APIClient()
        self.users = [
            ProfileFactory.create(),
            ProfileFactory.create(is_superuser=True, is_staff=True)
        ]
        self.reviews = [
            ReviewFactory.create(),
            ReviewFactory.create()
        ]

    def test_list_anonymous(self):
        response = self.client.get(reverse('review_exports-list'))

        self.assertEqual(response.status_code, 401)

    def test_list_not_staff(self):
        self.client.force_authenticate(self.users[0])

# Path: api_v3/factories/profile.py
# class ProfileFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Profile
# 
#     email = Faker('email')
#     first_name = Faker('first_name')
#     last_name = Faker('last_name')
#     bio = Faker('job')
#     last_login = Faker('past_date', start_date='-30d')
# 
# Path: api_v3/factories/review.py
# class ReviewFactory(DjangoModelFactory):
# 
#     class Meta:
#         model = Review
# 
#     ticket = SubFactory(TicketFactory)
#     body = Faker('bs')
# 
# Path: api_v3/tests/views/support.py
# class ApiTestCase(TestCase):
#     JSON_API_CONTENT_TYPE = 'application/vnd.api+json'
#     def as_jsonapi_payload(self, serializer_class, obj, update={}):


# Path: api_v3/tests/views/test_review_exports.py
from api_v3.factories import ProfileFactory, ReviewFactory
from .support import TestCase, APIClient, reverse

# -*- coding: utf-8 -*-


class ExpenseExportsEndpointTestCase(TestCase):
    def setUp(self):
        self.client = APIClient()
        self.users = [
            ProfileFactory.create(),
            ProfileFactory.create(is_superuser=True, is_staff=True)
        ]
        self.reviews = [
            ReviewFactory.create(),
            ReviewFactory.create()
        ]

    def test_list_anonymous(self):
        response = self.client.get(reverse('review_exports-list'))

        self.assertEqual(response.status_code, 401)

    def test_list_not_staff(self):
        self.client.force_authenticate(self.users[0])

        response = self.client.get(reverse('review_exports-list'))