# Path: hyperadmin/tests/test_resources.py
# class ResourceTestCase(URLReverseMixin, unittest.TestCase):
#     def setUp(self):
#         self.site = ResourceSite()
#         self.site.register_builtin_media_types()
#         
#         self.user = User.objects.get_or_create(username='superuser', is_staff=True, is_active=True, is_superuser=True)[0]
#         self.resource = self.register_resource()
#         
#         self.factory = SuperUserRequestFactory(user=self.user, HTTP_ACCEPT='text/html')
#         
#         self.resolver = GenericURLResolver(r'^', self.site.get_urls())
#         
#         self.patch_reverse(self.resolver)
#     
#     def tearDown(self):
#         self.unpatch_reverse()
#     
#     def get_api_request(self, **kwargs):
#         kwargs.setdefault('site', self.site)
#         kwargs.setdefault('user', self.user)
#         kwargs.setdefault('params', {})
#         kwargs.setdefault('method', 'GET')
#         kwargs.setdefault('payload', {})
#         kwargs.setdefault('request', self.factory.get('/'))
#         api_request = InternalAPIRequest(**kwargs)
#         
#         api_request.generate_response = MagicMock(return_value=HttpResponse())
#         
#         return api_request
#     
#     def register_resource(self):
#         raise NotImplementedError


import django
from hyperadmin.tests.test_resources import ResourceTestCase
        from hyperadmin.tests.wizard_fixtures import TestStorage, SimpleWizard
        from hyperadmin.tests.wizard_fixtures import TestStorage, ExpandedWizard
        self.assertEqual(endpoint.status, 'complete')
        self.assertEqual(response.endpoint.get_url_name(), 'admin_wizard_adduser_step_username')
        
    def test_username_step(self):
        #start = self.resource.get_link()
        data = {
            'username': 'foobar',
        }
        api_request = self.get_api_request(payload={'data':data}, method='POST')
        endpoint = self.resource.endpoints['username'].fork(api_request=api_request)
        endpoint.wizard.set_step_status('email', 'complete')
        assert endpoint.link_prototypes
        response = endpoint.generate_api_response(api_request)
        self.assertEqual(endpoint.status, 'complete')
        self.assertEqual(response.endpoint.get_url_name(), 'admin_wizard_adduser_step_password')
        
    def test_password_step(self):
        #start = self.resource.get_link()
        data = {
            'password': 'secret',
        }
        api_request = self.get_api_request(payload={'data':data}, method='POST')
        endpoint = self.resource.endpoints['password'].fork(api_request=api_request)
        endpoint.wizard.set_step_status('email', 'complete')
        endpoint.wizard.set_step_status('username', 'complete')
        assert endpoint.link_prototypes
        response = endpoint.generate_api_response(api_request)
        self.assertEqual(endpoint.status, 'complete')
        self.assertEqual(response, 'success')


# Path: hyperadmin/tests/test_resources.py
# class ResourceTestCase(URLReverseMixin, unittest.TestCase):
#     def setUp(self):
#         self.site = ResourceSite()
#         self.site.register_builtin_media_types()
#         
#         self.user = User.objects.get_or_create(username='superuser', is_staff=True, is_active=True, is_superuser=True)[0]
#         self.resource = self.register_resource()
#         
#         self.factory = SuperUserRequestFactory(user=self.user, HTTP_ACCEPT='text/html')
#         
#         self.resolver = GenericURLResolver(r'^', self.site.get_urls())
#         
#         self.patch_reverse(self.resolver)
#     
#     def tearDown(self):
#         self.unpatch_reverse()
#     
#     def get_api_request(self, **kwargs):
#         kwargs.setdefault('site', self.site)
#         kwargs.setdefault('user', self.user)
#         kwargs.setdefault('params', {})
#         kwargs.setdefault('method', 'GET')
#         kwargs.setdefault('payload', {})
#         kwargs.setdefault('request', self.factory.get('/'))
#         api_request = InternalAPIRequest(**kwargs)
#         
#         api_request.generate_response = MagicMock(return_value=HttpResponse())
#         
#         return api_request
#     
#     def register_resource(self):
#         raise NotImplementedError


# Path: hyperadmin/tests/test_wizard.py
import django
from hyperadmin.tests.test_resources import ResourceTestCase
        from hyperadmin.tests.wizard_fixtures import TestStorage, SimpleWizard
        from hyperadmin.tests.wizard_fixtures import TestStorage, ExpandedWizard

        self.assertEqual(endpoint.status, 'complete')
        self.assertEqual(response.endpoint.get_url_name(), 'admin_wizard_adduser_step_username')
        
    def test_username_step(self):
        #start = self.resource.get_link()
        data = {
            'username': 'foobar',
        }
        api_request = self.get_api_request(payload={'data':data}, method='POST')
        endpoint = self.resource.endpoints['username'].fork(api_request=api_request)
        endpoint.wizard.set_step_status('email', 'complete')
        assert endpoint.link_prototypes
        response = endpoint.generate_api_response(api_request)
        self.assertEqual(endpoint.status, 'complete')
        self.assertEqual(response.endpoint.get_url_name(), 'admin_wizard_adduser_step_password')
        
    def test_password_step(self):
        #start = self.resource.get_link()
        data = {
            'password': 'secret',
        }
        api_request = self.get_api_request(payload={'data':data}, method='POST')
        endpoint = self.resource.endpoints['password'].fork(api_request=api_request)
        endpoint.wizard.set_step_status('email', 'complete')
        endpoint.wizard.set_step_status('username', 'complete')
        assert endpoint.link_prototypes
        response = endpoint.generate_api_response(api_request)
        self.assertEqual(endpoint.status, 'complete')
        self.assertEqual(response, 'success')


class ExpandedWizardTestCase(ResourceTestCase):