Add mass_edit() and edit()
This commit is contained in:
parent
a03212ca94
commit
1371911c94
|
@ -403,3 +403,15 @@ class RefineProject:
|
||||||
'expression': expression, 'onError': on_error, 'repeat': repeat,
|
'expression': expression, 'onError': on_error, 'repeat': repeat,
|
||||||
'repeatCount': repeat_count})
|
'repeatCount': repeat_count})
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def edit(self, column, edit_from, edit_to):
|
||||||
|
edits = [{'from': [edit_from], 'to': edit_to}]
|
||||||
|
return self.mass_edit(column, edits)
|
||||||
|
|
||||||
|
def mass_edit(self, column, edits, expression='value'):
|
||||||
|
"""edits is [{'from': ['foo'], 'to': 'bar'}, {...}]"""
|
||||||
|
edits = json.dumps(edits)
|
||||||
|
response = self.do_json('mass-edit', {
|
||||||
|
'engine': self.engine.as_json(), 'columnName': column,
|
||||||
|
'expression': expression, 'edits': edits})
|
||||||
|
return response
|
||||||
|
|
|
@ -211,6 +211,10 @@ class TutorialTestTransformAndClustering(RefineTestCase):
|
||||||
self.assertTrue('6895' in response['historyEntry']['description'])
|
self.assertTrue('6895' in response['historyEntry']['description'])
|
||||||
response = self.project.compute_facets()
|
response = self.project.compute_facets()
|
||||||
self.assertEqual(len(response.facets[0].choices), 67)
|
self.assertEqual(len(response.facets[0].choices), 67)
|
||||||
|
# {5}
|
||||||
|
response = self.project.edit(column='Office Title',
|
||||||
|
'Councilmen', 'Councilman')
|
||||||
|
self.assertTrue('13' in response['historyEntry']['description'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue