Skip to content

Commit

Permalink
[#2003] pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Nov 3, 2014
1 parent 8459491 commit d8e9cb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion ckan/logic/action/patch.py
Expand Up @@ -3,6 +3,7 @@
import ckan.logic.action.update as _update
from ckan.logic import get_action as _get_action, check_access as _check_access


def package_patch(context, data_dict):
'''Patch a dataset (package).
Expand All @@ -26,7 +27,9 @@ def package_patch(context, data_dict):
'auth_user_obj': context['auth_user_obj'],
}

package_dict = _get_action('package_show')(show_context, {'id': name_or_id})
package_dict = _get_action('package_show')(
show_context,
{'id': name_or_id})

patched = dict(package_dict.items() + data_dict.items())
return _update.package_update(context, patched)
10 changes: 4 additions & 6 deletions ckan/new_tests/logic/action/test_patch.py
@@ -1,13 +1,12 @@
'''Unit tests for ckan/logic/action/update.py.'''
'''Unit tests for ckan/logic/action/patch.py.'''
import datetime

from nose.tools import assert_equals, assert_raises
import mock
import pylons.config as config

#import ckan.logic as logic
from ckan.new_tests import helpers
#import ckan.new_tests.factories as factories
from ckan.new_tests import helpers, factories


class TestPatch(helpers.FunctionalTestBase):

Expand All @@ -21,8 +20,7 @@ def test_package_patch_updating_single_field(self):
dataset = helpers.call_action(
'package_patch',
id=dataset['id'],
name='somethingnew',
)
name='somethingnew')

assert_equals(dataset['name'], 'somethingnew')
assert_equals(dataset['notes'], 'some test now')
Expand Down

0 comments on commit d8e9cb2

Please sign in to comment.