def test_metadata_sp_autoload_idp(self, sp_model_mock): '''The IdP metadata should not require loading of SP metadata.''' sp_instance_mock = Mock() sp_instance_mock.metadata_path.return_value = '/tmp/djangosaml2idp/1.xml' sp_model_mock.objects.filter.return_value = [sp_instance_mock] IDP._server_instance = None md = IDP.metadata() sp_instance_mock.metadata_path.assert_not_called()
def test_metadata_no_settings_defined(self, settings): IDP._server_instance = None settings.SAML_IDP_CONFIG = None with pytest.raises(ImproperlyConfigured): IDP.metadata()
def test_metadata_no_sp_defined_valid(self): IDP._server_instance = None md = IDP.metadata() assert isinstance(md, str)