def test_wrong_password(self): context = BaseContext() context.logger = logging.getLogger(__name__) context.config = { "auth": { "password-file": os.path.join( os.path.dirname(os.path.realpath(__file__)), "passwd" ) } } async def coro(): s = Session(None) s.username = "******" s.password = "******" auth_plugin = FileAuthPlugin(context) ret = await auth_plugin.authenticate(session=s) self.assertFalse(ret) anyio.run(coro)
def test_allow(self): context = BaseContext() context.logger = logging.getLogger(__name__) context.config = { 'auth': { 'password-file': os.path.join(os.path.dirname(os.path.realpath(__file__)), "passwd") } } async def coro(): s = Session(None) s.username = "******" s.password = "******" auth_plugin = FileAuthPlugin(context) ret = await auth_plugin.authenticate(session=s) self.assertTrue(ret) anyio.run(coro)