def test_resolver_fail(self): ''' Test to use a file, that does not exist ''' with self.assertRaisesRegexp(IOError, "No such file or directory: '/dev/shm/this_file_does_not_exist'"): self.y = UserIdResolver.getResolverClass("PasswdIdResolver", "IdResolver")() self.y.loadConfig({ 'linotp.passwdresolver.fileName' : '/dev/shm/this_file_does_not_exist' }, "")
def setUp(self): ''' you can add testusers like this python tools/create-pwidresolver-user.py -u user1 -i 10 -p pwU1 ''' file = "/dev/shm/test_users.txt" content = '''user1:0DM4AJtW/rTYY:10:10:User Eins:Irgendwas:Nochmal user2:.4UO1mxvTmdM6:11:11:User Zwei:Irgendwas:Nochmal ''' f = open(file, 'w') f.write(content) f.close() self.y = UserIdResolver.getResolverClass("PasswdIdResolver", "IdResolver")() self.y.loadConfig({ 'linotp.passwdresolver.fileName' : file }, "")