'Verify that preview themes behaves correctly.'

def test_preview_theme(self):

    global_staff = GlobalStaffFactory()
    self.client.login(username=global_staff.username, password=TEST_PASSWORD)
    post_response = self.client.post(THEMING_ADMIN_URL, {'action': 'set_preview_theme', 'preview_theme': TEST_THEME_NAME})
    self.assertRedirects(post_response, THEMING_ADMIN_URL)
    response = self.client.get(THEMING_ADMIN_URL)
    self.assertEquals(response.status_code, 200)
    self.assertContains(response, '<option    value="{theme_name}"    selected=selected>'.format(theme_name=TEST_THEME_NAME))
    post_response = self.client.post(THEMING_ADMIN_URL, {'action': 'reset_preview_theme'})
    self.assertRedirects(post_response, THEMING_ADMIN_URL)
    response = self.client.get(THEMING_ADMIN_URL)
    self.assertEquals(response.status_code, 200)
    self.assertContains(response, '<option    value="{theme_name}">'.format(theme_name=TEST_THEME_NAME))
