Exemple #1
0
    def __init__(self):  
        
        handlers = [
        (r"/", RootHandler),   
        (r"/rest/cell/volume/(.*)", VolumeHandler),
		(r"/rest/menu/volume/(.*)", VolumeHandler), # Fake
        
        ]
        
        settings = dict(
            template_path=os.path.join(os.path.dirname(__file__), "smtc/view"),
            static_path  =os.path.join(os.path.dirname(__file__), "static"),
            xsrf_cookies=False,
            cookie_secret="3c8b3cca9954fce0e696e1e299eb0ded",
        )
        
     
        # init and configuration
        setupDefaultConfig()
        self.volumeSrv = VolService()
        
        tornado.web.Application.__init__(self, handlers, **settings)
Exemple #2
0
        token=self.AuthService.getToken()
        self.assertEqual(self.Cell, token._CELL_NAME)
        return

    def test_get_artificialToken(self) :
        token=self.AuthService.get_artificial_Token(123,"openafs.org")
        self.assertEqual("openafs.org",token._CELL_NAME)
        self.assertEqual(123,token._AFS_ID)
        return
        
    def test_getTokenFromPassword(self):
        afs.defaultConfig.CRED_TYPE="krb5_password"
        token=self.AuthService.getToken()
        self.assertEqual(self.Cell, token._CELL_NAME)
        return
    
    def test_getTokenFromKeytab(self):
        afs.defaultConfig.CRED_TYPE="krb5_keytab:/home/hanke/private/keytab"
        token=self.AuthService.getToken()
        self.assertEqual(self.Cell, token._CELL_NAME)
        return
    
if __name__ == '__main__' :
    define("setup", default="./Test.cfg", help="path to Testconfig")
    setupDefaultConfig()
    if not os.path.exists(options.setup) :
        sys.stderr.write("Test setup file %s does not exist.\n" % options.setup)
        sys.exit(2)
    suite = unittest.TestLoader().loadTestsFromTestCase(TestAuthServiceMethods)
    unittest.TextTestRunner(verbosity=2).run(suite)