'The compose_views function() is used under the hood by
update_subscriptions_backend.  It\'s a pretty simple method in terms of
control flow, but it uses a Django rollback, which may make it brittle
code when we upgrade Django.  We test the functions\'s rollback logic
here with a simple scenario to avoid false positives related to
subscription complications.'

def test_compose_views_rollback(self):

    user_profile = self.example_user('hamlet')
    user_profile.full_name = 'Hamlet'
    user_profile.save()
    def method1(req, user_profile):
        user_profile.full_name = 'Should    not    be    committed'
        user_profile.save()
        return json_success()
    def method2(req, user_profile):
        return json_error('random    failure')
    with self.assertRaises(JsonableError):
        compose_views(None, user_profile, [(method1, {}), (method2, {})])
    user_profile = self.example_user('hamlet')
    self.assertEqual(user_profile.full_name, 'Hamlet')
