def test_single_predicate(self): dl_key, payload = download("decimalLatitude > 50", user="******", email="dummy", pwd="dummy") self.assertDictEqual( payload["predicate"]["predicates"][0], { "key": "DECIMAL_LATITUDE", "type": "greaterThan", "value": "50" }, ) dl_key, payload = download("basisOfRecord = LITERATURE", user="******", email="dummy", pwd="dummy") self.assertDictEqual( payload["predicate"]["predicates"][0], { "key": "BASIS_OF_RECORD", "type": "equals", "value": "LITERATURE" }, )
def test_single_predicate(self): dl_key, payload = download('decimalLatitude > 50', user="******", email="dummy", pwd="dummy") self.assertDictEqual(payload["predicate"]["predicates"][0], {'key': 'DECIMAL_LATITUDE', 'type': 'greaterThan', 'value': '50'}) dl_key, payload = download('basisOfRecord = LITERATURE', user="******", email="dummy", pwd="dummy") self.assertDictEqual(payload["predicate"]["predicates"][0], {'key': 'BASIS_OF_RECORD', 'type': 'equals', 'value': 'LITERATURE'})
def test_single_predicate_list(self): dl_key, payload = download(['decimalLatitude > 50'], user="******", email="dummy", pwd="dummy") self.assertDictEqual(payload["predicate"]["predicates"][0], {'key': 'DECIMAL_LATITUDE', 'type': 'greaterThan', 'value': '50'})
def test_alternative_main_type(self): dl_key, payload = download(['depth = 80', 'taxonKey = 2343454'], pred_type='or', user="******", email="dummy", pwd="dummy") self.assertEqual(payload["predicate"]["type"], 'or')
def test_alternative_main_type(self): dl_key, payload = download( ["depth = 80", "taxonKey = 2343454"], pred_type="or", user="******", email="dummy", pwd="dummy", ) self.assertEqual(payload["predicate"]["type"], "or")
def test_multiple_predicates(self): dl_key, payload = download(['taxonKey = 7264332', 'hasCoordinate = TRUE'], user="******", email="dummy", pwd="dummy") temp_pred = payload["predicate"]["predicates"] self.assertIsInstance(temp_pred, list) self.assertEquals(len(temp_pred), 2) self.assertIsInstance(temp_pred[0], dict) self.assertIsInstance(temp_pred[1], dict) self.assertEquals(set(list(temp_pred[0].keys())), set(['key', 'type', 'value'])) self.assertEquals(set(list(temp_pred[1].keys())), set(['key', 'type', 'value']))
def test_single_predicate_list(self): dl_key, payload = download(["decimalLatitude > 50"], user="******", email="dummy", pwd="dummy") self.assertDictEqual( payload["predicate"]["predicates"][0], { "key": "DECIMAL_LATITUDE", "type": "greaterThan", "value": "50" }, )