'The setting ``REGISTRATION_OPEN`` appropriately controls
whether registration is permitted.'

def test_allow(self):

    old_allowed = getattr(settings, 'REGISTRATION_OPEN', True)
    settings.REGISTRATION_OPEN = True
    resp = self.client.get(reverse('registration_register'))
    self.assertEqual(200, resp.status_code)
    settings.REGISTRATION_OPEN = False
    resp = self.client.get(reverse('registration_register'))
    self.assertRedirects(resp, reverse('registration_disallowed'))
    resp = self.client.post(reverse('registration_register'), data={'username': 'bob', 'email': 'bob@example.com', 'password1': 'secret', 'password2': 'secret'})
    self.assertRedirects(resp, reverse('registration_disallowed'))
    settings.REGISTRATION_OPEN = old_allowed
