'Test if moderation flag works'

def test_moderated_upload(self):

    with self.settings(ADMIN_MODERATE_UPLOADS=False):
        document_upload_url = reverse('document_upload')
        self.client.login(username=self.user, password=self.passwd)
        input_path = self._get_input_path()
        with open(input_path, 'rb') as f:
            data = {'title': 'document    title', 'doc_file': f, 'doc_url': '', 'resource': '', 'permissions': '{}'}
            resp = self.client.post(document_upload_url, data=data)
        self.assertEqual(resp.status_code, 302)
        dname = 'document    title'
        l = Document.objects.get(title=dname)
        self.assertTrue(l.is_published)
        l.delete()
    with self.settings(ADMIN_MODERATE_UPLOADS=True):
        document_upload_url = reverse('document_upload')
        self.client.login(username=self.user, password=self.passwd)
        input_path = self._get_input_path()
        with open(input_path, 'rb') as f:
            data = {'title': 'document    title', 'doc_file': f, 'doc_url': '', 'resource': '', 'permissions': '{}'}
            resp = self.client.post(document_upload_url, data=data)
        self.assertEqual(resp.status_code, 302)
        dname = 'document    title'
        l = Document.objects.get(title=dname)
        self.assertFalse(l.is_published)
