[ckan-changes] commit/ckan: John Glover: [1371] test task_status_update will update a row as well as creating a new one. Add get method to model.TaskStatus
Bitbucket
commits-noreply at bitbucket.org
Wed Oct 5 14:48:14 UTC 2011
1 new changeset in ckan:
http://bitbucket.org/okfn/ckan/changeset/b6b4110ed0f7/
changeset: b6b4110ed0f7
branch: feature-1371-task-status-logic-layer
user: John Glover
date: 2011-10-05 16:47:36
summary: [1371] test task_status_update will update a row as well as creating a new one. Add get method to model.TaskStatus
affected #: 2 files (-1 bytes)
--- a/ckan/model/task_status.py Wed Oct 05 15:24:05 2011 +0100
+++ b/ckan/model/task_status.py Wed Oct 05 15:47:36 2011 +0100
@@ -19,6 +19,10 @@
)
class TaskStatus(DomainObject):
- pass
+ @classmethod
+ def get(cls, reference):
+ '''Returns a task status object referenced by its id.'''
+ query = Session.query(cls).filter(cls.id==reference)
+ return query.first()
mapper(TaskStatus, task_status_table)
--- a/ckan/tests/functional/api/test_action.py Wed Oct 05 15:24:05 2011 +0100
+++ b/ckan/tests/functional/api/test_action.py Wed Oct 05 15:47:36 2011 +0100
@@ -561,10 +561,21 @@
extra_environ={'Authorization': str(self.sysadmin_user.apikey)},
)
task_status_updated = json.loads(res.body)['result']
- task_status_updated.pop('id')
+ task_status_id = task_status_updated.pop('id')
task_status_updated.pop('last_updated')
assert task_status_updated == task_status, (task_status_updated, task_status)
+ task_status_updated['id'] = task_status_id
+ task_status_updated['value'] = u'test_value_2'
+ postparams = '%s=1' % json.dumps(task_status_updated)
+ res = self.app.post(
+ '/api/action/task_status_update', params=postparams,
+ extra_environ={'Authorization': str(self.sysadmin_user.apikey)},
+ )
+ task_status_updated_2 = json.loads(res.body)['result']
+ task_status_updated_2.pop('last_updated')
+ assert task_status_updated_2 == task_status_updated, task_status_updated_2
+
def test_21_task_status_update_many(self):
pass
Repository URL: https://bitbucket.org/okfn/ckan/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list