def test_post_download(self):
        req = GbifDownload("name", "email")
        req.add_iterative_predicate('BASIS_OF_RECORD',
                                    ['FOSSIL_SPECIMEN', 'LITERATURE'])
        dl_key = req.post_download("name", "pwd")
        if not dl_key:
            raise KeyError("You might have too many downloads running at the \
                            same time. Check your downloads page!")

        while req.get_status() in ['PREPARING', 'RUNNING']:
            print('Preparing ...')
            time.sleep(10)
        self.assertIn(req.get_status(), ['SUCCEEDED', 'KILLED'])
Beispiel #2
0
    def test_post_download(self):
        req = GbifDownload("name", "email")
        req.add_iterative_predicate('BASIS_OF_RECORD',
                                    ['FOSSIL_SPECIMEN', 'LITERATURE'])
        dl_key = req.post_download("name", "pwd")
        if not dl_key:
            raise KeyError("You might have too many downloads running at the \
                            same time. Check your downloads page!")

        while req.get_status() in ['PREPARING', 'RUNNING']:
            print('Preparing ...')
            time.sleep(10)
        self.assertIn(req.get_status(), ['SUCCEEDED', 'KILLED'])
Beispiel #3
0
    def test_post_download(self):
        req = GbifDownload("name", "email")
        req.add_iterative_predicate("BASIS_OF_RECORD",
                                    ["FOSSIL_SPECIMEN", "LITERATURE"])
        dl_key = req.post_download("name", "pwd")
        if not dl_key:
            raise KeyError("You might have too many downloads running at the \
                            same time. Check your downloads page!")

        while req.get_status() in ["PREPARING", "RUNNING"]:
            print("Preparing ...")
            time.sleep(10)
        self.assertIn(req.get_status(), ["SUCCEEDED", "KILLED"])
    def test_add_iterative_predicate(self):
        """the the predicate addition of an iterative sequence"""
        req = GbifDownload("name", "email")
        req.add_iterative_predicate("TAXONKEY", [3189866, 2498252])
        self.assertIsInstance(req.payload["predicate"]["predicates"], list)
        self.assertEquals(len(req.payload["predicate"]["predicates"]), 1)
        self.assertIsInstance(req.payload["predicate"]["predicates"][0], dict)

        temp_pred = req.payload["predicate"]["predicates"][0]["predicates"]
        self.assertIsInstance(temp_pred, list)
        self.assertEquals(len(temp_pred), 2)
        self.assertIsInstance(temp_pred[0], dict)

        self.assertEquals(set(list(temp_pred[0].keys())),
                             set(['key', 'type', 'value']))
        self.assertEquals(req.payload["predicate"]["predicates"][0]['type'],
                          'or')
Beispiel #5
0
    def test_add_iterative_predicate(self):
        """the the predicate addition of an iterative sequence"""
        req = GbifDownload("name", "email")
        req.add_iterative_predicate("TAXONKEY", [3189866, 2498252])
        self.assertIsInstance(req.payload["predicate"]["predicates"], list)
        self.assertEquals(len(req.payload["predicate"]["predicates"]), 1)
        self.assertIsInstance(req.payload["predicate"]["predicates"][0], dict)

        temp_pred = req.payload["predicate"]["predicates"][0]["predicates"]
        self.assertIsInstance(temp_pred, list)
        self.assertEquals(len(temp_pred), 2)
        self.assertIsInstance(temp_pred[0], dict)

        self.assertEquals(set(list(temp_pred[0].keys())),
                             set(['key', 'type', 'value']))
        self.assertEquals(req.payload["predicate"]["predicates"][0]['type'],
                          'or')