From ebbba565bfbca37df39581d959d608c3a191305e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Muszy=C5=84ski?= Date: Fri, 16 Jan 2015 15:46:50 +0100 Subject: [PATCH] linkin/unlinking topics - behat tests --- features/3_api_topics.feature | 3 +- ..._link_unlink_topic_to_from_article.feature | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 features/4_api_link_unlink_topic_to_from_article.feature diff --git a/features/3_api_topics.feature b/features/3_api_topics.feature index 3f743c7fc1..47ea7ede78 100644 --- a/features/3_api_topics.feature +++ b/features/3_api_topics.feature @@ -5,8 +5,7 @@ Feature: Testing Topics API Scenario: Checking topics endpoint When I request "/topics" - Then the response status code should be 200 - And the response is JSON + Then the response is JSON Scenario: Creating a new root topic and checking if it has been created successfully Given that I want to make a new topic diff --git a/features/4_api_link_unlink_topic_to_from_article.feature b/features/4_api_link_unlink_topic_to_from_article.feature new file mode 100644 index 0000000000..5c666c2c4e --- /dev/null +++ b/features/4_api_link_unlink_topic_to_from_article.feature @@ -0,0 +1,54 @@ +Feature: Testing linking/unlinking topics to/from the articles + In order to link/ublink topics through the API + As a service user + I want to see if the topics can be linked or unlinked to/from the articles + + Scenario: Create a new article and topic, then link/unlink topic from created article + Given that I want to create an new article + And that i have fake "article" data: + | name | <> | 4 | + | language | 1 || + | publication | 1 || + | issue | || + | section | || + | comments_enabled | 1 || + | type | news || + | onFrontPage | 0 || + | onSection | 0 || + | keywords | <> | 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 make a new topic + And that i have fake "topic" data: + | title | roottopic | 4 | + + And I'm logged in as "testuser" with "testpassword" with client "1_svdg45ew371vtsdgd29fgvwe5v" and secret "h48fgsmv0due4nexjsy40jdf3sswwr" + When I submit "topic" data to "/topics" + Then the response status code should be 201 + And the response is JSON + Then save new item location as "new_topic" + + Given that I want to link that topic to the article + And that i have "link" header with "<$$new_topic$$; rel='topic'>" value + When I request "<>" + Then the response status code should be 201 + And the response is JSON + + Given that I want to unlink that topic from article + And that i have "link" header with "<$$new_topic$$; rel='topic'>" value + When I request "<>" + Then the response status code should be 204 + And the response is JSON + + Given that I want to delete an topic + When I request "<>" + Then the response status code should be 204 + And the response is JSON \ No newline at end of file