Tests are run from the project root directory. But are run in the context of the dummy app located under test/dummy. In order to run the tests you must first setup dummy app database.
rake db:setup; rake -f test/dummy/Rakefile test:prepare
Once you have done this cd to the project root and run the following:
rake spec
This will allow you to runn the commands below to test out the engine in isolation (if mounted in another application, the main difference will just be where the engine gets mounted, so adjust your url accordingly).
cd test/dummy; rails s
Request
curl -X POST --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/base_images --data \ "<base_image> <name>MyFirstBaseImage</name> <description>This is my very first base image</description> </base_image>"
Response
Code: 201 Body: <base_image href='http://localhost:3000/tim/base_images/1' id='1'> <name>MyFirstBaseImage</name> <description>This is my very first base image</description> </base_image>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/base_images/1
Response
Code: 200 Body: <base_image href='http://localhost:3000/tim/base_images/1' id='1'> <name>MyFirstBaseImage</name> <description>This is my very first base image</description> <image_versions> </image_versions> </base_image>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/base_images
Response
Code: 200 Body: <base_images> <base_image href='http://localhost:3000/tim/base_images/1' id='1'></base_image> <base_image href='http://localhost:3000/tim/base_images/2' id='2'></base_image> <base_image href='http://localhost:3000/tim/base_images/3' id='3'></base_image> </base_images>
Request
curl -X DELETE--header "Accept: application/xml" http://localhost:3000/tim/base_images/1
Response
Code: 204 Body:
Request
curl -X POST --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/image_versions --data \ "<image_version> <base_image id='1'></base_image> </image_version>"
Response
Code: 201 Body: <image_version href='http://localhost:3000/tim/image_versions/5' id='5'> <base_image href='http://localhost:3000/tim/base_images/1' id='1'></base_image> <target_images> </target_images> </image_version>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/image_versions/1
Response
Code: 200 Body: <image_version href='http://localhost:3000/tim/image_versions/1' id='1'> <base_image href='http://localhost:3000/tim/base_images/1' id='1'></base_image> <target_images> </target_images> </image_version>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/image_versions
Response
Code: 200 Body: <image_versions> <image_version href='http://localhost:3000/tim/image_versions/1' id='1'></image_version> <image_version href='http://localhost:3000/tim/image_versions/2' id='2'></image_version> <image_version href='http://localhost:3000/tim/image_versions/3' id='3'></image_version> </image_versions>
Request
curl -X DELETE--header "Accept: application/xml" http://localhost:3000/tim/image_versions/1
Response
Code: 204 Body:
Request
curl -X PUT --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/image_versions/1 --data \ "<image_version> <base_image id='2'></base_image> </image_version>"
Response
Code: 200 body: <image_version href='http://localhost:3000/tim/image_versions/1' id='1'> <base_image href='http://localhost:3000/tim/base_images/2' id='2'></base_image> <target_images> </target_images> </image_version>
Request
curl -X POST --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/target_images --data \ "<target_image> <image_version id='2' /> </target_image>"
Response
Code: 201 Body:
<target_image href=‘localhost:3000/tim/target_images/1’ id=‘1’>
<target>EC2</target> <status>BUILDING</status> <status_detail></status_detail> <progress>0</progress> <image_version href='http://localhost:3000/tim/image_versions/2' id='2'></image_version> <provider_images></provider_images>
</target_image>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/target_images/1
Response
Code: 200 Body: <target_image href='http://localhost:3000/tim/target_images/1' id='1'> <target>EC2</target> <status>COMPLETE</status> <status_detail></status_detail> <progress>100</progress> <image_version href='http://localhost:3000/tim/image_versions/2' id='2'></image_version> <provider_images></provider_images> </target_image>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/target_images
Response
Code: 200 Body: <target_images> <target_image href='http://localhost:3000/tim/target_images/1' id='1'></target_image> <target_image href='http://localhost:3000/tim/target_images/2' id='2'></target_image> <target_image href='http://localhost:3000/tim/target_images/3' id='3'></target_image> </target_images>
Request
curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/target_images/1
Response
Code: 204 Body:
Request
curl -X PUT --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/target_images/2 --data \ "<target_image> <image_version id='3'></image_version> </target_image>"
Response
Code: 204
Request
curl -X POST --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/provider_images --data \ "<provider_image> <target_image id='1' /> </provider_image>"
Response
Code: 201 Body: <provider_image href='http://localhost:3000/tim/provider_images/85' id='85'> <provider>Amazon EC2</provider> <external_image_id>ami-123456</external_image_id> <snapshot>false</snapshot> <status>NEW</status> <status_detail></status_detail> <progress>0</progress> <target_image href='http://localhost:3000/tim/target_images/1' id='1'></target_image> </provider_image>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/provider_images/1
Response
Code: 200 Body: <provider_image href='http://localhost:3000/tim/provider_images/85' id='85'> <provider>Amazon EC2</provider> <external_image_id>ami-123456</external_image_id> <snapshot>false</snapshot> <status>NEW</status> <status_detail></status_detail> <progress>0</progress> <target_image href='http://localhost:3000/tim/target_images/1' id='1'></target_image> </provider_image>
Request
curl --header "Accept: application/xml" http://localhost:3000/tim/provider_images
Response
Code: 200 Body: <provider_images> <provider_image href='http://localhost:3000/tim/provider_images/1' id='1'></provider_image> <provider_image href='http://localhost:3000/tim/provider_images/2' id='2'></provider_image> <provider_image href='http://localhost:3000/tim/provider_images/3' id='3'></provider_image> </provider_image>
Request
curl -X DELETE --header "Accept: application/xml" http://localhost:3000/tim/provider_images/1
Response
Code: 204 Body:
Request
curl -X PUT --header "Accept: application/xml" --header \ "Content-Type: application/xml" http://localhost:3000/tim/provider_images/2 --data \ "<provider_image> <target_image id='3'></target_image> </provider_image>"
Response
Code: 204 Body: <provider_image href='http://localhost:3000/tim/provider_images/84' id='84'> <provider></provider> <external_image_id></external_image_id> <snapshot></snapshot> <status></status> <status_detail></status_detail> <progress></progress> <target_image href='http://localhost:3000/tim/target_images/3' id='3'></target_image> </provider_image>
Image Management Engine is released under the MIT license.