def test_create_database(self): dropdb() create_database() self.assertTrue(database_connectivity()) self.assertTrue(database_exists()) self.assertTrue(schema_is_sane()) self.assertFalse(schema_has_data())
continue else: fq_url = "ftp://%s" % parts[1] try: filename = fq_to_sample_id.search(fq_url).group(0) except: continue sample_id = filename.rstrip('.fastq.gz').strip('seqs_') insert_fastq_sample(cur, sample_id, fq_url) if __name__ == '__main__': import sys if not database_connectivity(): sys.stderr.write("Cannot connect to the database\n") sys.exit(1) if not database_exists(): sys.stderr.write('Database does not exist\n') sys.exit(1) if not schema_is_sane(): sys.stderr.write('Schema does not appear to be sane\n') sys.exit(1) c = connect(user=agr.admin_db_user, host=agr.db_host, password=agr.admin_db_password, dbname=agr.db_name) c.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) cur = c.cursor() if biom_unchanged(cur):
def test_database_connectivity(self): # assumes we actually can connect with the provided credentials self.assertTrue(database_connectivity()) self.assertFalse(database_connectivity(user='******'))