-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new article api resource, fix api image updating, add behat tests
- Loading branch information
1 parent
98b227a
commit a2f9b61
Showing
71 changed files
with
2,655 additions
and
1,616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
default: | ||
paths: | ||
features: %behat.paths.base%/features | ||
bootstrap: %behat.paths.features%/bootstrap | ||
filters: | ||
context: | ||
parameters: | ||
base_url: http://newscoop.dev/api | ||
oauth_url: http://newscoop.dev/oauth | ||
publication: newscoop.dev | ||
api_prefix: api | ||
base_url: http://newscoop.dev/api/ | ||
publication: newscoop.dev | ||
paths: | ||
base: %behat.paths.base% | ||
bootstrap: features/bootstrap | ||
steps: features/steps | ||
hooks: features/support | ||
subContexts: | ||
associative: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Feature: Endpoints | ||
I need to be able to read api informations | ||
|
||
Scenario: Check if route is correct | ||
Given that I want to find an articles | ||
When I request "/articles" | ||
And the response is JSON | ||
|
||
Scenario: Create new article | ||
Given that I want to create an new article | ||
And that i have fake "article" data: | ||
| name | <<sentence>> | 4 | | ||
| language | 1 || | ||
| publication | 1 || | ||
| issue | || | ||
| section | || | ||
| comments_enabled | 1 || | ||
| type | news || | ||
| onFrontPage | 0 || | ||
| onSection | 0 || | ||
| keywords | <<text>> | 30 | | ||
|
||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I submit "article" data to "/articles/create" | ||
Then the response status code should be 201 | ||
And the response is JSON | ||
And the response should contain field "number" | ||
And the response should contain field "title" | ||
And the response should contain field "type" | ||
Then save new item location as "new_article" | ||
|
||
Given that I want to create an new article | ||
And that i have fake "article" data: | ||
| name | <<sentence>> | 4 | | ||
| language | 1 || | ||
| publication | 1 || | ||
| issue | || | ||
| section | || | ||
| comments_enabled | 1 || | ||
| type | news || | ||
| onFrontPage | 1 || | ||
| onSection | 1 || | ||
| keywords | test keywords | 30 | | ||
| fields[lead] | <<sentence>> | 15 | | ||
| fields[content] | <<sentence>> | 35 | | ||
|
||
When I submit "article" data to "<<new_article>>" | ||
Then the response status code should be 200 | ||
And the response is JSON | ||
And field "keywords" in the response should be "test keywords" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Feature: Images | ||
I need to be able to work with images api | ||
|
||
Scenario: Check if route is correct | ||
Given that I want to find an articles | ||
When I request "/images" | ||
And the response is JSON | ||
|
||
Scenario: Create new image | ||
Given that I want to create an new image | ||
And that i have fake "image" data: | ||
| description | <<sentence>> | 6 | | ||
| photographer | <<name>> | | | ||
| photographer_url | <<url>> | | | ||
| place | <<address>> | | | ||
| image | <<image>> | /tmp,640,480 | | ||
|
||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I submit "image" data to "/images" | ||
Then the response status code should be 201 | ||
And the response is JSON | ||
And the response should contain field "photographer" | ||
And the response should contain field "photographerUrl" | ||
And the response should contain field "description" | ||
Then save new item location as "new_image" | ||
|
||
Given that I want to find an article | ||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I request "<<new_image>>" | ||
Then the response status code should be 200 | ||
And the response is JSON | ||
And the response should contain field "photographer" | ||
And the response should contain field "photographerUrl" | ||
And the response should contain field "description" | ||
|
||
Given that I want to create an new image | ||
And that i have fake "image" data: | ||
| description | <<sentence>> | 12 | | ||
| photographer | <<name>> | | | ||
| photographer_url | <<url>> | | | ||
| place | <<address>> | | | ||
|
||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I submit "image" data to "<<new_image>>" | ||
Then the response status code should be 200 | ||
And the response is JSON | ||
And the response should contain field "photographer" | ||
And the response should contain field "photographerUrl" | ||
And the response should contain field "description" | ||
|
||
Given that I want to delete an image | ||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I request "<<new_image>>" | ||
Then the response status code should be 204 | ||
And the response is JSON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Feature: Images | ||
I need to be able to work link images to articles | ||
|
||
Scenario: Create new article and image | ||
Given that I want to create an new article | ||
And that i have fake "article" data: | ||
| name | <<sentence>> | 4 | | ||
| language | 1 || | ||
| publication | 1 || | ||
| issue | || | ||
| section | || | ||
| comments_enabled | 1 || | ||
| type | news || | ||
| onFrontPage | 0 || | ||
| onSection | 0 || | ||
| keywords | <<text>> | 30 | | ||
|
||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I submit "article" data to "/articles/create" | ||
Then the response status code should be 201 | ||
And the response is JSON | ||
And the response should contain field "number" | ||
And the response should contain field "title" | ||
And the response should contain field "type" | ||
Then save new item location as "new_article" | ||
|
||
Given that I want to create an new image | ||
And that i have fake "image" data: | ||
| description | <<sentence>> | 6 | | ||
| photographer | <<name>> | | | ||
| photographer_url | <<url>> | | | ||
| place | <<address>> | | | ||
| image | <<image>> | /tmp,640,480 | | ||
|
||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I submit "image" data to "/images" | ||
Then the response status code should be 201 | ||
And the response is JSON | ||
And the response should contain field "photographer" | ||
And the response should contain field "photographerUrl" | ||
And the response should contain field "description" | ||
Then save new item location as "new_image" | ||
|
||
Given that I want to link an image to article | ||
And that i have "link" header with "<$$new_image$$; rel='image'>" value | ||
When I request "<<new_article>>" | ||
Then the response status code should be 201 | ||
And the response is JSON | ||
|
||
Given that I want to unlink an image from article | ||
And that i have "link" header with "<$$new_image$$; rel='image'>" value | ||
When I request "<<new_article>>" | ||
Then the response status code should be 204 | ||
And the response is JSON | ||
|
||
Given that I want to delete an image | ||
And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" | ||
When I request "<<new_image>>" | ||
Then the response status code should be 204 | ||
And the response is JSON |
Oops, something went wrong.