def test_uri_resolver_pyramid(self): import ptah def resolver1(uri): return 'Resolved-pyramid' config = testing.setUp() config.include('ptah') config.ptah_uri_resolver('test1', resolver1) config.commit() self.assertEqual(ptah.resolve('test1:uri'), 'Resolved-pyramid')
def test_auth_provider_pyramid(self): import ptah class Provider(object): def authenticate(self, creds): if creds['login'] == 'user': return Principal('1', 'user', 'user') config = testing.setUp() config.include('ptah') self.assertTrue(getattr(config, 'ptah_auth_provider')) config.ptah_auth_provider('test-provider', Provider()) config.commit() info = ptah.auth_service.authenticate( {'login': '******', 'password': '******'}) self.assertTrue(info.status) self.assertEqual(info.__uri__, '1')