def test_alternative_main_type(self):
     """test the addition of another predicate combiner"""
     req = GbifDownload("name", "email")
     req.main_pred_type = "or"
     self.assertIsInstance(req.payload, dict)
     self.assertDictEqual(req.payload, {'created': 2016, 'creator': 'name',
                                        'notification_address': ['email'],
                                        'predicate': {'predicates': [],
                                                      'type': 'or'},
                                        'send_notification': 'true'})
示例#2
0
 def test_alternative_main_type(self):
     """test the addition of another predicate combiner"""
     req = GbifDownload("name", "email")
     req.main_pred_type = "or"
     self.assertIsInstance(req.payload, dict)
     self.assertDictEqual(req.payload, {'created': 2018, 'creator': 'name',
                                        'notification_address': ['email'],
                                        'predicate': {'predicates': [],
                                                      'type': 'or'},
                                        'send_notification': 'true'})
    def test_lookup_predicates(self):
        """different lookups checked"""
        # main combination predicate
        req = GbifDownload("name", "email")
        req.main_pred_type = "|"
        self.assertEqual(req.payload['predicate']['type'], "or")

        # predicate addition
        req.add_predicate("YEAR", "2000", ">=")
        self.assertEqual(req.payload["predicate"]["predicates"][0]["type"],
                         "greaterThanOrEquals")
示例#4
0
    def test_lookup_predicates(self):
        """different lookups checked"""
        # main combination predicate
        req = GbifDownload("name", "email")
        req.main_pred_type = "|"
        self.assertEqual(req.payload['predicate']['type'], "or")

        # predicate addition
        req.add_predicate("YEAR", "2000", ">=")
        self.assertEqual(req.payload["predicate"]["predicates"][0]["type"],
                         "greaterThanOrEquals")
示例#5
0
 def test_alternative_main_type(self):
     """test the addition of another predicate combiner"""
     req = GbifDownload("name", "email")
     req.main_pred_type = "or"
     self.assertIsInstance(req.payload, dict)
     self.assertDictEqual(
         req.payload,
         {
             "created": int(time.strftime("%Y")),
             "creator": "name",
             "notification_address": ["email"],
             "predicate": {
                 "predicates": [],
                 "type": "or"
             },
             "send_notification": "true",
         },
     )