@skipUnless(contrib_apps('admin', 'auth', 'sessions'),
                'admin, auth or sessions not in INSTALLED_APPS')
    @skipUnless(user_model_quite_standard(), 'Too custom User model')
    def test_admin(self):
        """Test if synchronization can be performed via admin interface."""
        path = reverse('synchro')
        user = User._default_manager.create_user('admin', 'mail', 'admin')
        self.client.login(username='admin', password='admin')
        # test if staff status is required
        response = self.client.get(path)
        try:
            self.assertTemplateUsed(response, 'admin/login.html')
        except __HOLE__:  # Django >= 1.7
            self.assertIn('location', response._headers)
            self.assertIn('/admin/login/', response._headers['location'][1])
        user.is_staff = True
        user.save()
        # superuser
        self.assertTemplateUsed(self.client.get(path), 'synchro.html')
        # actual synchronization
        self.reset()
        TestModel.objects.create(name='James', cash=7)
        self.assertRemoteCount(0, TestModel)
        self.client.post(path, {'synchro': True})  # button clicked
        self.assertRemoteCount(1, TestModel)
        # resetting
        self.assertGreater(ChangeLog.objects.count(), 0)
        self.client.post(path, {'reset': True})  # button clicked
        self.assertEqual(ChangeLog.objects.count(), 0)
dataset/ETHPy150Open zlorf/django-synchro/synchro/tests.py/SimpleSynchroTests.test_admin