Closed (fixed)
Project:
Services
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Oct 2010 at 21:47 UTC
Updated:
17 Feb 2011 at 06:51 UTC
Jump to comment: Most recent file
Endpoint test cases need to be written for the creation, deletion, and usage of service endpoints.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | services-d7-tests-user-resource.patch | 19.58 KB | ygerasimov |
| #16 | services-d7-tests-node-resource.patch | 34.84 KB | ygerasimov |
| #14 | services-comment-system-tests.test | 66.58 KB | ygerasimov |
| #13 | services-comment-system-tests.test | 0 bytes | ygerasimov |
| #12 | services_tests_taxonomy_resource.patch | 54.45 KB | ygerasimov |
Comments
Comment #1
johnstorey commentedUPDATE: I made a mistake uploading works in progress. Please scroll down to my patch with full functional endpoint tests and unit tests for services.module. I'll start a new issue for the next file I write unit tests for.
This is the first set of code for the functional endpoint tests. Please note:
Apologies for not figuring out how to create a proper patch for this one, but adding directories to a CVS repository seems to be a fairly dark art. I thought it better to get the first revision of the code out and worry about that again for the next patch.
Comment #2
johnstorey commentedAdded in more test cases and created a proper patch file that will add in the necessary files. This incorporates and supercedes the previous files.
Comment #3
johnstorey commentedNew tests patch file, superceding previous files.
Comment #4
johnstorey commentedI mistepped trying to upload works in progress. Here is my first cut at full functional endpoint tests and unit tests for the services.module.
I will start another issue for unit tests in another file. Putting them all in one issue means I won't have anything to show for months.
Comment #6
ygerasimov commentedHere is patch for testing node resource with REST server. See #984426: Testing REST server node resourse. for more details.
Comment #7
kylebrowning commentedeeek, ygerasimov, I already did this for Node Endpoint testing. Its in the dev branches for 6.x and 7.x already.
Comment #8
ygerasimov commentedI have done review of the tests for 6.x-3.x branch and edited them a bit. Mainly replaced statements like:
with simple
$this->assertTrue()Also changed curlExec to have proper call method (GET, PUT, POST, DELETE) displayed.
Is there any specific reason to use json format in calls instead of serialized PHP? I believe we can simplify preparing arguments if we use serialized PHP (we will not have functions services_build_postfields, services_flatten_fields).
Comment #9
kylebrowning commentedHey ygerasimov, I like the changes, but IM curious why this wasnt done to the ServicesResourceNodeTests.test.
Can they be made to that file so the patch applies cleanly.
I think your version of services might be a bit outdated. See beta2
I restructured the code a bit so that its easier to run tests one at a time. The old way would have taken like10 minutes to run through all the resource endpoints. This way now allows us to have a set of test cases per resource and we can run them one by one, saving a ton of time.
Comment #10
ygerasimov commentedI have rerolled patch and done following:
1. Changed calls to expect serialized php.
2. Changed formatting (spaces problems).
3. Fixed definition of constructor for class ServicesArgumentException
Comment #11
ygerasimov commentedHere is patch with tests for user resource.
Please note that in order to pass it will need to be fixed issues #1013720: User resource. Method index SQL error when parameters passed. and #967786: Rest_server passing GET arguments
Comment #12
ygerasimov commentedHere is patch with tests for taxonomy resource.
In order to pass patches from following issues should be applied:
#967786: Rest_server passing GET arguments
#1025186: Taxonomy resource. selectNodes method default values
Comment #13
ygerasimov commentedHere is patch with all tests including tests for comment and service resources.
Needed patches to pass tests:
#967786: Rest_server passing GET arguments
#1025186: Taxonomy resource. selectNodes method default values
#1028682: System resource. set_variable method
Comment #14
ygerasimov commentedhm... something gone wrong with patch. Another try.
Comment #15
kylebrowning commentedOk These tests have been comitted for 6.x, setting this to 7.x as thees tests need to be forward ported
Comment #16
ygerasimov commentedI have started working on tests for D7. Here is node resource test.
In order to pass following patches should be applied:
#1039144: Node resource. Update method Exceptions
#1039142: Node resource. Nid argument type missing
Comment #17
kylebrowning commentedThese have been committed, and yes yes yes all tests passed!!
Setting to needs work b/c now all we need Taxonomy, File, Comment, User and system.
Comment #18
ygerasimov commentedTest is ready for user_resource. There a lot of changes:
1. node_resource.inc -- minor styling changes
2. user_resource.inc
a. delete method default arguments
b. update method rebuilt
c. login action small changes
d. index method small changes
3. services.runtime.inc -- add default value of $data value for constructor of ServicesArgumentException
4. Test for user resource itself.
ALso what I have noticed is in D6 in login method variables called 'name' and 'pass' but in D7 they are 'username' and 'password'. I think we should have the same names (I like full names 'username' and 'password'). Please advise your comments about this so I will prepare patch for both resource and test.
Comment #19
kylebrowning commentedWere closing this and separating the remaining issues out to their own tickets.