'Verify that when an EnterpriseCustomer is received on the login and register views,
the appropriate sidebar is rendered.'

@mock.patch('student_account.views.enterprise_customer_for_request')
@ddt.data(('signin_user', False, None, None, None), ('register_user', False, None, None, None), ('signin_user', True, 'Fake    EC', 'http://logo.com/logo.jpg', u'{enterprise_name}    -    {platform_name}'), ('register_user', True, 'Fake    EC', 'http://logo.com/logo.jpg', u'{enterprise_name}    -    {platform_name}'), ('signin_user', True, 'Fake    EC', None, u'{enterprise_name}    -    {platform_name}'), ('register_user', True, 'Fake    EC', None, u'{enterprise_name}    -    {platform_name}'), ('signin_user', True, 'Fake    EC', 'http://logo.com/logo.jpg', None), ('register_user', True, 'Fake    EC', 'http://logo.com/logo.jpg', None), ('signin_user', True, 'Fake    EC', None, None), ('register_user', True, 'Fake    EC', None, None))
@ddt.unpack
def test_enterprise_register(self, url_name, ec_present, ec_name, logo_url, welcome_message, mock_get_ec):

    if ec_present:
        mock_ec = mock_get_ec.return_value
        mock_ec.name = ec_name
        if logo_url:
            mock_ec.branding_configuration.logo.url = logo_url
        else:
            mock_ec.branding_configuration.logo = None
        if welcome_message:
            mock_ec.branding_configuration.welcome_message = welcome_message
        else:
            del mock_ec.branding_configuration.welcome_message
    else:
        mock_get_ec.return_value = None
    response = self.client.get(reverse(url_name), HTTP_ACCEPT='text/html')
    enterprise_sidebar_div_id = u'enterprise-content-container'
    if (not ec_present):
        self.assertNotContains(response, text=enterprise_sidebar_div_id)
    else:
        self.assertContains(response, text=enterprise_sidebar_div_id)
        if (not welcome_message):
            welcome_message = settings.ENTERPRISE_SPECIFIC_BRANDED_WELCOME_TEMPLATE
        expected_message = welcome_message.format(start_bold=u'<b>', end_bold=u'</b>', enterprise_name=ec_name, platform_name=settings.PLATFORM_NAME)
        self.assertContains(response, expected_message)
        if logo_url:
            self.assertContains(response, logo_url)
