Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #3

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c86c11a
STOR 431 - Fix Spaces.me client call
JosimarCamargo Oct 30, 2020
ff0221b
STOR 431 - Fix InsecureRequestWarning: Unverified HTTPS
JosimarCamargo Oct 30, 2020
62e58ea
STOR 431 - Add test for Spaces.me and info how to run the test suite
JosimarCamargo Oct 30, 2020
0f5b917
STOR 431 - Fix Stories.list auth and add basic tests
JosimarCamargo Oct 30, 2020
a459130
STOR 431 - Fix Stories.single auth and add basic tests
JosimarCamargo Nov 3, 2020
9f6a175
STOR 431 - Move token from URL to request params
JosimarCamargo Nov 3, 2020
9d43cc6
STOR 431 - Update README and add test for single draft story
JosimarCamargo Nov 3, 2020
6cc18a1
STOR 431 - Fix DataSourceEntries auth and add basic tests
JosimarCamargo Nov 3, 2020
99575bd
STOR 431 - Fix Tags auth and add basic tests
JosimarCamargo Nov 3, 2020
c2e7d85
STOR 431 - Fix doc Typo
JosimarCamargo Nov 3, 2020
50d4157
STOR 431 - Add CDN Datasources endpoint calls + Update README
JosimarCamargo Nov 3, 2020
9d63d82
STOR 431 - Move token logic to param_adapter module
JosimarCamargo Nov 3, 2020
8209164
STOR 431 - Fix Links auth + add basic tests
JosimarCamargo Nov 3, 2020
a0d0af1
STOR 431 - Add Client.get method + basic tests
JosimarCamargo Nov 4, 2020
cb73394
STOR 431 - Add Client.post method + basic tests
JosimarCamargo Nov 4, 2020
e82d6ea
STOR 431 - Add Client.put method + basic tests
JosimarCamargo Nov 4, 2020
65cf9fc
STOR 431 - Add Client.delete method + basic tests
JosimarCamargo Nov 4, 2020
59b1e8a
STOR 431 - Move auth from custom requests to sb_auth module
JosimarCamargo Nov 4, 2020
d69a324
STOR 431 - Update Spaces to make calls by internal authenticated client
JosimarCamargo Nov 4, 2020
d92c1dd
STOR 431 - Update Tags to make calls by internal authenticated client
JosimarCamargo Nov 4, 2020
b344e60
STOR 431 - Update Stories to make calls by internal authenticated client
JosimarCamargo Nov 4, 2020
9e95e99
STOR 431 - Update Links to make calls by internal authenticated client
JosimarCamargo Nov 4, 2020
3e22801
STOR 431 - Update Datasources to make calls by internal authenticated…
JosimarCamargo Nov 4, 2020
68ec64e
STOR 431 - Update DatasourceEntries to make calls by internal authent…
JosimarCamargo Nov 4, 2020
096d3ff
STOR 431 - Remove deprecated module param_adapter
JosimarCamargo Nov 4, 2020
a8f6634
STOR 431 - Update README
JosimarCamargo Nov 4, 2020
f03d927
added api region
joaokamun Feb 10, 2022
1a5578b
remove pprint
joaokamun Aug 24, 2022
f1309ec
Merge pull request #4 from storyblok/feature/INT-158
joaokamun Oct 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
STOR 431 - Fix Stories.list auth and add basic tests
JosimarCamargo committed Oct 30, 2020
commit 0f5b917fe1eecd178902b42e45d1c98970b4b624
2 changes: 1 addition & 1 deletion storyblok/api/stories.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ def list(self, token, options={}):
"""
body = options['query'] if 'query' in options else {}

response = self.client.get('/cdn/stories/', body, options)
response = self.client.get('/cdn/stories/?token=' + token, body, options)

return response

67 changes: 67 additions & 0 deletions tests/test_stories.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import pytest
import storyblok

public_token = "KOesmZuJLW2Yy7QJcMuFPQtt"
preview_token = "Nb8l74hQYP1hrrIA0lE7Lwtt"

@pytest.fixture
def stories():
client = storyblok.Client()
return client.stories()

def test_stories_list_published(stories):
response = stories.list(public_token)

assert response.code == 200
assert 'stories' in response.body.keys()
assert type(response.body['stories']) is list

first_story = response.body['stories'][0]
assert 'id' in first_story.keys()
assert 'name' in first_story.keys()
assert 'created_at' in first_story.keys()
assert 'published_at' in first_story.keys()
assert 'uuid' in first_story.keys()
assert 'uuid' in first_story.keys()
assert 'content' in first_story.keys()
assert 'slug' in first_story.keys()
assert 'full_slug' in first_story.keys()
assert 'tag_list' in first_story.keys()

def test_stories_list_draft(stories):
response = stories.list(preview_token, {"query": { "version": "draft"}})

assert response.code == 200
assert 'stories' in response.body.keys()
assert type(response.body['stories']) is list

first_story = response.body['stories'][0]
assert 'id' in first_story.keys()
assert 'name' in first_story.keys()
assert 'created_at' in first_story.keys()
assert 'published_at' in first_story.keys()
assert 'uuid' in first_story.keys()
assert 'uuid' in first_story.keys()
assert 'content' in first_story.keys()
assert 'slug' in first_story.keys()
assert 'full_slug' in first_story.keys()
assert 'tag_list' in first_story.keys()

def test_stories_list_simple_querying(stories):
response = stories.list("KOesmZuJLW2Yy7QJcMuFPQtt", {"query": { "with_tag": "tag_from_my_second_folder"}})

assert response.code == 200
assert 'stories' in response.body.keys()
assert type(response.body['stories']) is list
for story in response.body['stories']:
assert story['tag_list'][0] == "tag_from_my_second_folder"

def test_stories_list_with_multi_params_querying(stories):
response = stories.list(preview_token, {"query": { "is_startpage": "false", "with_tag": "tag_from_my_second_folder"}})

assert response.code == 200
assert 'stories' in response.body.keys()
assert type(response.body['stories']) is list
for story in response.body['stories']:
assert story['tag_list'][0] == "tag_from_my_second_folder"
assert story['is_startpage'] == False