'Test that the account connection message depends on the next URL.
https://bugzil.la/1054461'

def test_account_connected_message(self, next_url='/', has_message=False, extra_tags=''):

    request = self.rf.get('/')
    request.user = self.user
    session = self.client.session
    session['sociallogin_next_url'] = next_url
    session.save()
    request.session = session
    request.LANGUAGE_CODE = 'en-US'
    messages = self.get_messages(request)
    self.adapter.add_message(request, django_messages.INFO, self.message_template, extra_tags=extra_tags)
    queued_messages = list(messages)
    if has_message:
        assert (len(queued_messages) == 1)
        message_data = queued_messages[0]
        assert (message_data.level == django_messages.SUCCESS)
        assert ('connected' in message_data.message)
    else:
        assert (not queued_messages)
    return queued_messages
