# Path: osf_tests/factories.py
# class AuthUserFactory(UserFactory):
#     """A user that automatically has an api key, for quick authentication.
# 
#     Example: ::
#         user = AuthUserFactory()
#         res = self.app.get(url, auth=user.auth)  # user is "logged in"
#     """
# 
#     @factory.post_generation
#     def add_auth(self, create, extracted):
#         self.auth = (self.username, 'queenfan86')
# 
# class RegistrationProviderFactory(DjangoModelFactory):
#     name = factory.Faker('company')
#     description = factory.Faker('bs')
#     external_url = factory.Faker('url')
#     access_token = factory.Faker('bs')
#     share_source = factory.Sequence(lambda n: 'share source #{0}'.format(n))
# 
#     class Meta:
#         model = models.RegistrationProvider
# 
#     @classmethod
#     def _create(cls, *args, **kwargs):
#         user = kwargs.pop('creator', None)
#         _id = kwargs.pop('_id', None)
#         try:
#             obj = cls._build(*args, **kwargs)
#         except IntegrityError as e:
#             # This is to ensure legacy tests don't fail when their _ids aren't unique
#             if _id == models.RegistrationProvider.default__id:
#                 pass
#             else:
#                 raise e
#         if _id and _id != 'osf':
#             obj._id = _id
# 
#         obj._creator = user or models.OSFUser.objects.first() or UserFactory()  # Generates primary_collection
#         obj.save()
#         return obj
# 
# class RegistrationBulkUploadJobFactory(DjangoModelFactory):
#     class Meta:
#         model = models.RegistrationBulkUploadJob


import pytest
import mock
import hashlib
from rest_framework.exceptions import NotFound
from osf.registrations.utils import DuplicateHeadersError, FileUploadNotSupportedError, InvalidHeadersError
from api.base.settings import BULK_SETTINGS
from osf_tests.factories import (
    AuthUserFactory,
    RegistrationProviderFactory,
    RegistrationBulkUploadJobFactory,
)
from webtest_plus.app import _add_auth


@pytest.mark.django_db
class TestRegistrationBulkUpload():

    @pytest.fixture()
    def unauthorized_user(self):

# Path: osf_tests/factories.py
# class AuthUserFactory(UserFactory):
#     """A user that automatically has an api key, for quick authentication.
# 
#     Example: ::
#         user = AuthUserFactory()
#         res = self.app.get(url, auth=user.auth)  # user is "logged in"
#     """
# 
#     @factory.post_generation
#     def add_auth(self, create, extracted):
#         self.auth = (self.username, 'queenfan86')
# 
# class RegistrationProviderFactory(DjangoModelFactory):
#     name = factory.Faker('company')
#     description = factory.Faker('bs')
#     external_url = factory.Faker('url')
#     access_token = factory.Faker('bs')
#     share_source = factory.Sequence(lambda n: 'share source #{0}'.format(n))
# 
#     class Meta:
#         model = models.RegistrationProvider
# 
#     @classmethod
#     def _create(cls, *args, **kwargs):
#         user = kwargs.pop('creator', None)
#         _id = kwargs.pop('_id', None)
#         try:
#             obj = cls._build(*args, **kwargs)
#         except IntegrityError as e:
#             # This is to ensure legacy tests don't fail when their _ids aren't unique
#             if _id == models.RegistrationProvider.default__id:
#                 pass
#             else:
#                 raise e
#         if _id and _id != 'osf':
#             obj._id = _id
# 
#         obj._creator = user or models.OSFUser.objects.first() or UserFactory()  # Generates primary_collection
#         obj.save()
#         return obj
# 
# class RegistrationBulkUploadJobFactory(DjangoModelFactory):
#     class Meta:
#         model = models.RegistrationBulkUploadJob


# Path: api_tests/providers/registrations/views/test_registration_provider_bulk_upload.py
import pytest
import mock
import hashlib
from rest_framework.exceptions import NotFound
from osf.registrations.utils import DuplicateHeadersError, FileUploadNotSupportedError, InvalidHeadersError
from api.base.settings import BULK_SETTINGS
from osf_tests.factories import (
    AuthUserFactory,
    RegistrationProviderFactory,
    RegistrationBulkUploadJobFactory,
)
from webtest_plus.app import _add_auth



@pytest.mark.django_db
class TestRegistrationBulkUpload():

    @pytest.fixture()
    def unauthorized_user(self):

        return AuthUserFactory()