Merge lp:~cjohnston/ubuntu-ci-services-itself/write-ticket-resource into lp:ubuntu-ci-services-itself
Proposed by
Chris Johnston
Status: | Merged |
---|---|
Approved by: | Chris Johnston |
Approved revision: | 56 |
Merged at revision: | 57 |
Proposed branch: | lp:~cjohnston/ubuntu-ci-services-itself/write-ticket-resource |
Merge into: | lp:ubuntu-ci-services-itself |
Diff against target: |
96 lines (+65/-1) 3 files modified
ticket_system/ticket/api.py (+3/-1) ticket_system/ticket/tests/__init__.py (+1/-0) ticket_system/ticket/tests/test_write_api.py (+61/-0) |
To merge this branch: | bzr merge lp:~cjohnston/ubuntu-ci-services-itself/write-ticket-resource |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andy Doan (community) | Approve | ||
Review via email:
|
Commit message
Add write API and tests for the ticket resource
Description of the change
Add write API and tests for the ticket resource
To post a comment you must log in.
On 12/19/2013 02:28 PM, Chris Johnston wrote:
> === added file 'ticket_ system/ ticket/ tests/test_ write_api. py'
> + def test_post_ ticket( self): l(Ticket. objects. count() , 1) resource= self.resource, params= self.post_ ticket_ data) l(Ticket. objects. count() , 2)
> + # Check how many are there first.
> + self.assertEqua
> + self.post(
> + # Verify a new one has been added.
> + self.assertEqua
might be worth taking the ID from self.post and making sure the
post_ticket_data matches the object that got created. not a big deal though.
> + def test_patch_ detail( self): e(self. detail_ url) data.copy( ) l(Ticket. objects. count() , 1) patch(' /api/v1/ ' + self.detail_url, data=new_data) MethodNotAllowe d(resp) l(Ticket. objects. count() , 1) l(Ticket. objects. get(pk= self.ticket. pk).owner,
> + # Grab the current data & modify it slightly.
> + original_data = self.getResourc
> + new_data = original_
> + new_data['owner'] = '<email address hidden>'
> +
> + self.assertEqua
> + resp = self.client.
> + self.assertHttp
> + # Make sure the count hasn't changed & we did an update.
> + self.assertEqua
> + # Check for updated data.
> + self.assertEqua
> + self.ticket.owner)
Should this assert be: assertEqual( Ticket. objects. get(pk= self.ticket. pk).owner,
new_ data['owner' ])
self.