def test_get_provider_config(self):
     r = RequestFactory()
     request = r.get('/sso/saml/?provider=MyProvider', **dict(HTTP_HOST='example.com'))
     req = prepare_django_request(request)
     config = get_provider_config(req)
     mock_cfg = MOCK_SAML2_CONFIG[0]['MyProvider']
     for top_attr in mock_cfg.keys():
         if type(top_attr) is dict:
             for key, value in top_attr.iteritems():
                 self.assertEqual(mock_cfg[key], config[key])
         else:
             self.assertEqual(mock_cfg[top_attr], config[top_attr])
 def test_get_provider_config_with_missing_query_str(self):
     r = RequestFactory()
     request = r.get('/sso/saml/', **dict(HTTP_HOST='example.com'))
     req = prepare_django_request(request)
     config = get_provider_config(req)
     self.assertEqual(config['name'], 'MyProvider')