Exemple #1
0
    def test_get_artifact_error(self):
        # Mock the URIs
        httpretty.register_uri(
            httpretty.GET,
            "https://test_server.com/qiita_db/artifacts/1/filepaths/",
            body='{"filepaths": '', "success": false, "error": "some error"}')

        with self.assertRaises(ValueError):
            get_artifact_information(self.qclient, 1)
Exemple #2
0
    def test_get_artifact_information(self):
        # Mock the URIs
        httpretty.register_uri(
            httpretty.GET,
            "https://test_server.com/qiita_db/artifacts/1/filepaths/",
            body='{"filepaths": [["forward_seqs.fastq.gz", "raw_forward_seqs"]'
                 ', ["barcodes.fastq.gz", "raw_barcodes"]], "success": true, '
                 '"error": ""}')
        httpretty.register_uri(
            httpretty.GET,
            "https://test_server.com/qiita_db/artifacts/1/mapping/",
            body='{"mapping": "mapping_file.txt", "success": true, '
                 '"error": ""}')
        httpretty.register_uri(
            httpretty.GET,
            "https://test_server.com/qiita_db/artifacts/1/type/",
            body='{"type": "FASTQ", "success": true, "error": ""}')

        obs_fps, obs_mf, obs_at = get_artifact_information(self.qclient, 1)

        exp_fps = [["forward_seqs.fastq.gz", "raw_forward_seqs"],
                   ["barcodes.fastq.gz", "raw_barcodes"]]
        self.assertEqual(obs_fps, exp_fps)
        self.assertEqual(obs_mf, "mapping_file.txt")
        self.assertEqual(obs_at, "FASTQ")