def test_error_message_retrieval(self):
     sq = sqlClient(self.testDB)
     sq.create_conn()
     response = sq.get_error_message_from_code(1)
     self.assertEqual(response,
                      "The summary statistics file cannot be found")
     response = sq.get_error_message_from_code(0)
     self.assertIsNone(response)
 def setUp(self):
     self.testDB = "./tests/study_meta.db"
     self.test_storepath = "./tests/data"
     config.STORAGE_PATH = self.test_storepath
     config.BROKER_PORT = 5682
     config.BROKER_HOST = "localhost"
     sq = sqlClient(self.testDB)
     sq.create_conn()
     sq.cur.executescript(config.DB_SCHEMA)
 def setUp(self):
     self.testDB = "./tests/study_meta.db"
     self.test_storepath = "./tests/data"
     config.STORAGE_PATH = self.test_storepath
     config.DB_PATH = self.testDB
     sq = sqlClient(self.testDB)
     sq.create_conn()
     sq.cur.executescript(config.DB_SCHEMA)
     self.valid_url = "file://{}".format(
         os.path.abspath("./tests/test_sumstats_file.tsv"))
Ejemplo n.º 4
0
 def setup_method(self, method):
     self.testDB = "./tests/study_meta.db"
     self.test_storepath = "./tests/data"
     config.STORAGE_PATH = self.test_storepath
     config.DB_PATH = self.testDB
     celery.conf['CELERY_ALWAYS_EAGER'] = True
     sq = sqlClient(self.testDB)
     sq.create_conn()
     sq.cur.executescript(config.DB_SCHEMA)
     self.valid_url = "file://{}".format(os.path.abspath("./tests/test_sumstats_file.tsv"))
 def test_cannot_insert_same_study_twice(self):
     sq = sqlClient(self.testDB)
     sq.create_conn()
     sq.insert_new_study([
         VALID_POST["requestEntries"][0]["id"], "callback123",
         VALID_POST["requestEntries"][0]["filePath"],
         VALID_POST["requestEntries"][0]["md5"],
         VALID_POST["requestEntries"][0]["assembly"],
         VALID_POST["requestEntries"][0]["readme"],
         VALID_POST["requestEntries"][0]["entryUUID"]
     ])
     response = sq.get_study_count()
     self.assertEqual(response, 1)
 def test_insert_new_study(self):
     sq = sqlClient(self.testDB)
     sq.create_conn()
     sq.insert_new_study([
         VALID_POST["requestEntries"][0]["id"], "callback123",
         VALID_POST["requestEntries"][0]["filePath"],
         VALID_POST["requestEntries"][0]["md5"],
         VALID_POST["requestEntries"][0]["assembly"],
         VALID_POST["requestEntries"][0]["readme"],
         VALID_POST["requestEntries"][0]["entryUUID"]
     ])
     response = sq.get_study_metadata("abc123")
     self.assertTrue(response)
Ejemplo n.º 7
0
    def setUp(self):
        self.testDB = "./tests/study_meta.db"
        self.test_storepath = "./tests/data"
        config.STORAGE_PATH = self.test_storepath
        config.DB_PATH = self.testDB
        config.BROKER_PORT = 5682
        config.BROKER_HOST = "localhost"
        sq = sqlClient(self.testDB)
        sq.create_conn()
        sq.cur.executescript(config.DB_SCHEMA)

        self.study_id = "123abc123"
        self.callback_id = "abc123xyz"
        self.file_path = "file/path.tsv"
        self.md5 = "b1d7e0a58d36502d59d036a17336ddf5"
        self.assembly = "GRCh38"
 def test_update_retrieved_status(self):
     sq = sqlClient(self.testDB)
     sq.create_conn()
     sq.insert_new_study([
         VALID_POST["requestEntries"][0]["id"], "callback123",
         VALID_POST["requestEntries"][0]["filePath"],
         VALID_POST["requestEntries"][0]["md5"],
         VALID_POST["requestEntries"][0]["assembly"],
         VALID_POST["requestEntries"][0]["readme"],
         VALID_POST["requestEntries"][0]["entryUUID"]
     ])
     sq.update_retrieved_status(VALID_POST["requestEntries"][0]["id"], 1)
     response = sq.get_study_metadata(VALID_POST["requestEntries"][0]["id"])
     self.assertEqual(response[5], 1)
     sq.update_retrieved_status(VALID_POST["requestEntries"][0]["id"], 0)
     response = sq.get_study_metadata(VALID_POST["requestEntries"][0]["id"])
     self.assertEqual(response[5], 0)
 def test_select_from_callback_id(self):
     sq = sqlClient(self.testDB)
     sq.create_conn()
     sq.insert_new_study([
         VALID_POST["requestEntries"][0]["id"], "callback123",
         VALID_POST["requestEntries"][0]["filePath"],
         VALID_POST["requestEntries"][0]["md5"],
         VALID_POST["requestEntries"][0]["assembly"],
         VALID_POST["requestEntries"][0]["readme"],
         VALID_POST["requestEntries"][0]["entryUUID"]
     ])
     sq.insert_new_study([
         VALID_POST["requestEntries"][1]["id"], "callback123",
         VALID_POST["requestEntries"][0]["filePath"],
         VALID_POST["requestEntries"][0]["md5"],
         VALID_POST["requestEntries"][0]["assembly"],
         VALID_POST["requestEntries"][0]["readme"],
         VALID_POST["requestEntries"][0]["entryUUID"]
     ])
     response = sq.get_data_from_callback_id("callback123")
     self.assertIsNotNone(response)
     self.assertEqual(len(response), 2)
     self.assertEqual(response[0][0], VALID_POST["requestEntries"][0]["id"])
     self.assertEqual(response[1][0], VALID_POST["requestEntries"][1]["id"])