def test_enrich_client_from_remote_config_default_app_many_apps(self):
        def _create_client_from_config(config):
            return Client([self.stormpath_app, self.application, self.application])

        config = {'application': {}}
        ecfrcs = EnrichClientFromRemoteConfigStrategy(client_factory=_create_client_from_config)

        with self.assertRaises(Exception):
            ecfrcs.process(config)
Esempio n. 2
0
    def test_enrich_client_from_remote_config_default_app_no_app(self):
        def _create_client_from_config(config):
            return Client([self.stormpath_app])

        config = {'application': {}}
        ecfrcs = EnrichClientFromRemoteConfigStrategy(
            client_factory=_create_client_from_config)

        with self.assertRaises(Exception):
            ecfrcs.process(config)
Esempio n. 3
0
    def test_enrich_client_from_remote_config_app_by_invalid_name(self):
        def _create_client_from_config(config):
            return Client([self.application])

        config = {'application': {'name': 'invalid'}}

        ecfrcs = EnrichClientFromRemoteConfigStrategy(
            client_factory=_create_client_from_config)
        with self.assertRaises(Exception):
            ecfrcs.process(config)
    def test_enrich_client_from_remote_config_app_by_invalid_name(self):
        def _create_client_from_config(config):
            return Client([self.application])

        config = {
            'application': {
                'name': 'invalid'
            }
        }

        ecfrcs = EnrichClientFromRemoteConfigStrategy(client_factory=_create_client_from_config)
        with self.assertRaises(Exception):
            ecfrcs.process(config)
    def test_enrich_client_from_remote_config_default_app(self):
        def _create_client_from_config(config):
            return Client([self.stormpath_app, self.application])

        config = {'application': {}}

        ecfrcs = EnrichClientFromRemoteConfigStrategy(client_factory=_create_client_from_config)
        ecfrcs.process(config)

        self.assertIsInstance(config['application'], dict)
        self.assertEqual(config['application'], {
            'href': 'https://api.stormpath.com/v1/applications/a',
            'name': 'My named application',
        })
Esempio n. 6
0
    def test_enrich_client_from_remote_config_default_app(self):
        def _create_client_from_config(config):
            return Client([self.stormpath_app, self.application])

        config = {'application': {}}

        ecfrcs = EnrichClientFromRemoteConfigStrategy(
            client_factory=_create_client_from_config)
        ecfrcs.process(config)

        self.assertIsInstance(config['application'], dict)
        self.assertEqual(
            config['application'], {
                'href': 'https://api.stormpath.com/v1/applications/a',
                'name': 'My named application',
            })