def tearDownClass(cls): cleanup_test_resources_by_tag([ (UNIQUE_TAG, ), (UNIQUE_TAG, { 'resource_type': 'raw' }), (UNIQUE_TAG, { 'type': 'twitter_name' }), ]) cleanup_test_resources([ ([TEST_ID1, TEST_ID2], ), ([TEXT_ID], { 'type': 'text' }), ([TEST_DOCX_ID], { 'resource_type': 'raw' }), ]) cleanup_test_transformation([ ([TEST_TRANS_SCALE2_STR, TEST_TRANS_SCALE2_PNG_STR], ), ]) api.delete_metadata_field(METADATA_FIELD_UNIQUE_EXTERNAL_ID) api.delete_metadata_field(METADATA_FIELD_EXTERNAL_ID_SET)
def tearDownClass(cls): cleanup_test_resources_by_tag([ (UNIQUE_TAG, ), (UNIQUE_TAG, { 'resource_type': 'raw' }), (UNIQUE_TAG, { 'type': 'twitter_name' }), ]) cleanup_test_resources([ ([TEST_ID1, TEST_ID2], ), ([TEXT_ID], { 'type': 'text' }), ([TEST_DOCX_ID], { 'resource_type': 'raw' }), ]) cleanup_test_transformation([ ([TEST_TRANS_SCALE2_STR, TEST_TRANS_SCALE2_PNG_STR], ), ]) with ignore_exception( suppress_traceback_classes=(exceptions.BadRequest, )): api.delete_metadata_field(METADATA_FIELD_UNIQUE_EXTERNAL_ID)
def test10_delete_metadata_field(self, mocker): """Test deleting a metadata field definition by its external id.""" mocker.return_value = MOCK_RESPONSE api.delete_metadata_field(EXTERNAL_ID_DELETE) args, kargs = mocker.call_args target_uri = "/metadata_fields/{}".format(EXTERNAL_ID_DELETE) self.assertTrue(get_uri(args).endswith(target_uri)) self.assertEqual(get_method(mocker), "DELETE") self.assertEqual(json.loads(kargs["body"].decode('utf-8')), {})
def test11_delete_metadata_field_does_not_release_external_id(self): """Test deleting a metadata field definition then attempting to create a new one with the same external id which should fail. """ api.delete_metadata_field(EXTERNAL_ID_DELETE_2) with self.assertRaises(api.BadRequest): api.add_metadata_field({ "external_id": EXTERNAL_ID_DELETE_2, "label": EXTERNAL_ID_DELETE_2, "type": "integer", })
def tearDownClass(cls): api.delete_metadata_field(METADATA_EXTERNAL_ID) cleanup_test_resources([([API_TEST_ID, API_TEST_ID2, API_TEST_ID3, API_TEST_ID4, API_TEST_ID5],)]) cleanup_test_transformation([ ([API_TEST_TRANS, API_TEST_TRANS2, API_TEST_TRANS3, API_TEST_TRANS_SCALE100_STR],), ]) cleanup_test_resources_by_tag([ (UNIQUE_API_TAG,), (UNIQUE_API_TAG, {'resource_type': 'raw'}), ]) with ignore_exception(suppress_traceback_classes=(NotFound,)): api.delete_upload_mapping(MAPPING_TEST_ID)
def tearDownClass(cls): for external_id in METADATA_FIELDS: with ignore_exception(suppress_traceback_classes=(api.NotFound,)): api.delete_metadata_field(external_id)