示例#1
0
    def test_init(self):
        theapp = app.CromulentApp("tests/data/cromulent/app/jes.conf")
        self.assertIsNotNone(theapp)
        self.assertIsNotNone(theapp.config)
        self.assertIsNone(theapp.db)
        self.assertEqual(theapp.config['database']['db']['user'], 'cromwell')
        self.assertEqual(theapp.config['database']['db']['password'], 'words')

        theapp = app.CromulentApp()
        self.assertIsNone(theapp.config)
        self.assertIsNone(theapp.db)
示例#2
0
 def test_connect(self):
     theapp = app.CromulentApp("tests/data/cromulent/app/sqlite.conf")
     self.assertIsNotNone(theapp)
     self.assertIsNotNone(theapp.config)
     self.assertIsNone(theapp.db)
     self.assertEqual(theapp.config['database']['db']['file'], 'tests/data/cromulent/app/test.db')
     db = theapp.connect()
     self.assertIsNotNone(db)
     self.assertIsNotNone(theapp.db)
示例#3
0
文件: cli.py 项目: hall-lab/cromulent
def cli(ctx):
    '''
    A collection of cromwell helpers.

    Configuration
    Set the "CROMULENT_CONFIG" environment variable to the HOCON (JES)
    config file used by cromwell. Please see README for more details.
    '''
    # to make this script/module behave nicely with unix pipes
    # http://newbebweb.blogspot.com/2012/02/python-head-ioerror-errno-32-broken.html
    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
    ctx.obj = app.CromulentApp(os.environ.get('CROMULENT_CONFIG', None))
示例#4
0
 def test_runsql(self):
     theapp = app.CromulentApp("tests/data/cromulent/app/sqlite.conf")
     db = theapp.connect()
     sqlrun.run(db, "tests/data/cromulent/sqlrun/select.sql")
示例#5
0
 def test_connect_fail(self):
     theapp = app.CromulentApp()
     with self.assertRaises(Exception) as cm:
         theapp.connect()
     self.assertTrue("No configuration found to connect to database!" in cm.exception)
示例#6
0
 def test_init_fails(self):
     with self.assertRaises(IOError) as cm:
         app.CromulentApp("/jes.conf")
     self.assertTrue("No such file or directory" in cm.exception)