Fix tests
This commit is contained in:
parent
ebfb70331a
commit
8d9208544f
|
@ -199,7 +199,7 @@ class PrivateDatasets(p.SingletonPlugin, tk.DefaultDatasetForm):
|
|||
'use_cache': False},
|
||||
{'id': package_id})
|
||||
# Prevent acquired datasets jumping to the first position
|
||||
new_pkg_dict['metadata_modified'] = new_pkg_dict['revision_timestamp']
|
||||
new_pkg_dict['metadata_modified'] = new_pkg_dict.get('revision_timestamp', '')
|
||||
self.indexer.update_dict(new_pkg_dict)
|
||||
|
||||
return pkg_dict
|
||||
|
|
|
@ -282,8 +282,10 @@ class PluginTest(unittest.TestCase):
|
|||
package_id = 'package_id'
|
||||
|
||||
# Configure mocks
|
||||
default_dict = {'a': '0', 'b': 1, 'm': True}
|
||||
package_show = MagicMock(return_value=default_dict)
|
||||
default_dict = {'a': '0', 'b': 1, 'm': True, 'revision_timestamp': '2000'}
|
||||
expected_dict = default_dict.copy()
|
||||
expected_dict['metadata_modified'] = default_dict['revision_timestamp']
|
||||
package_show = MagicMock(return_value=default_dict.copy())
|
||||
plugin.tk.get_action = MagicMock(return_value=package_show)
|
||||
|
||||
# Each time 'AllowedUser' is called, we must get a new instance
|
||||
|
@ -336,7 +338,7 @@ class PluginTest(unittest.TestCase):
|
|||
self.assertEquals(0, self.privateDatasets.indexer.update_dict.call_count)
|
||||
else:
|
||||
# Check that the cache has been updated
|
||||
self.privateDatasets.indexer.update_dict.assert_called_once_with(default_dict)
|
||||
self.privateDatasets.indexer.update_dict.assert_called_once_with(expected_dict)
|
||||
|
||||
@parameterized.expand([
|
||||
# One element
|
||||
|
|
Loading…
Reference in New Issue