コード例 #1
0
ファイル: test_field_mapper.py プロジェクト: fruviad/combine
 def test_validate_config_json_provided(self):
     invalid_config_mapper = FieldMapper(
         config_json=json_string({"add_literals": "invalid value"}))
     self.assertIsNone(
         invalid_config_mapper.validate_config_json(
             json_string({"add_literals": {
                 "foo": "bar"
             }})))
コード例 #2
0
ファイル: test_field_mapper.py プロジェクト: fruviad/combine
 def setUpTestData(cls):
     cls.attributes = {
         'name': 'Test Field Mapper',
         'config_json': json_string({"add_literals": {
             "foo": "bar"
         }}),
         'field_mapper_type': 'xml2kvp'
     }
     cls.field_mapper = FieldMapper(**cls.attributes)
コード例 #3
0
 def setUp(self):
     self.config = TestConfiguration()
     task_params_json = {
         "job_id": self.config.job.id,
         "record_group_id": self.config.record_group.id,
         "org_id": self.config.org.id
     }
     self.bg_task = CombineBackgroundTask.objects.create(
         celery_task_id='test celery id',
         task_type='job_reindex',
         task_params_json=json_string(task_params_json))
コード例 #4
0
 def test_get_bg_task_no_job(self):
     new_task_params = {
         "record_group_id": self.config.record_group.id,
         "org_id": self.config.org.id
     }
     new_task = CombineBackgroundTask.objects.create(
         celery_task_id='new celery id',
         task_type='export_documents',
         task_params_json=json_string(new_task_params))
     response = self.client.get(
         f'/combine/background_tasks/task/{new_task.id}')
     self.assertIn(b'new celery id', response.content)
     self.assertIn(b'Download Documents as Archive', response.content)
コード例 #5
0
 def test_post_test_field_mapper(self):
     field_mapper = FieldMapper.objects.create(
         field_mapper_type='xml2kvp',
         config_json=json_string({"add_literals": {
             "foo": "bar"
         }}),
         name='test field mapper')
     response = self.client.post(
         reverse('test_field_mapper'), {
             'db_id': self.config.record.id,
             'fm_config_json': field_mapper.config_json
         })
     self.assertEqual(response.json(), {
         'root_foo': 'test document',
         'foo': 'bar'
     })
コード例 #6
0
ファイル: test_field_mapper.py プロジェクト: fruviad/combine
 def test_validate_config_json_invalid(self):
     invalid_config_mapper = FieldMapper(
         config_json=json_string({"add_literals": "invalid value"}))
     self.assertRaises(jsonschema.exceptions.ValidationError,
                       invalid_config_mapper.validate_config_json)