Example #1
0
    def test_validate_pid_uniqueness_4(self):
        errors = defaultdict(list)
        data = self._get_unflattened_data()
        self._set_unflattened_data_random_id(data)
        flat_data = flatten_dict(copy.deepcopy(data))
        self._set_random_pids_for_unflattened_data(data)
        self._create_package_with_unflattened_data(data)

        try:
            validate_pid_uniqueness(('pids', 0, 'id'), flat_data, errors, None)
            validate_pid_uniqueness(('pids', 1, 'id'), flat_data, errors, None)
            validate_pid_uniqueness(('pids', 2, 'id'), flat_data, errors, None)
            validate_pid_uniqueness(('pids', 3, 'id'), flat_data, errors, None)
        except Invalid as e:
            self.fail("validate_pid_uniqueness_4 failed: {0}".format(e))
Example #2
0
 def test_validate_pid_uniqueness_1(self):
     errors = defaultdict(list)
     flat_data = self._get_flat_data()
     self._set_flat_data_random_id(flat_data)
     try:
         validate_pid_uniqueness(('pids', 0, 'id'), flat_data, errors, None)
         validate_pid_uniqueness(('pids', 1, 'id'), flat_data, errors, None)
         validate_pid_uniqueness(('pids', 2, 'id'), flat_data, errors, None)
     except Invalid as e:
         self.fail("validate_pid_uniqueness_1 failed: {0}".format(e))