'Test SAML login logs with debug mode enabled or not'

@ddt.data(True, False)
def test_debug_mode_login(self, debug_mode_enabled):

    self._configure_testshib_provider(debug_mode=debug_mode_enabled)
    with patch.object(saml_log, 'info') as mock_log:
        super(TestShibIntegrationTest, self).test_login()
    if debug_mode_enabled:
        self.assertEqual(mock_log.call_count, 4)
        ((msg, action_type, idp_name, xml), _kwargs) = mock_log.call_args_list[0]
        self.assertTrue(msg.startswith('SAML    login    %s'))
        self.assertEqual(action_type, 'request')
        self.assertEqual(idp_name, self.PROVIDER_IDP_SLUG)
        self.assertIn('<samlp:AuthnRequest', xml)
        ((msg, action_type, idp_name, xml), _kwargs) = mock_log.call_args_list[1]
        self.assertTrue(msg.startswith('SAML    login    %s'))
        self.assertEqual(action_type, 'response')
        self.assertEqual(idp_name, self.PROVIDER_IDP_SLUG)
        self.assertIn('<saml2p:Response', xml)
    else:
        self.assertFalse(mock_log.called)
