Skip to content

Commit

Permalink
Merge pull request #52 from dolevf/add-search-test
Browse files Browse the repository at this point in the history
Add search test
  • Loading branch information
nicholasaleks authored Jun 27, 2022
2 parents aa7d79a + c66fcf5 commit fc9de5b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions tests/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,34 @@ def test_query_search_on_paste_object():
assert r.json()['data']['search'][0]['burn'] == False
assert r.json()['data']['search'][0]['ownerId']


def test_query_search_on_user_and_paste_object():
query = '''
query {
search(keyword: "p") {
... on UserObject {
username
}
... on PasteObject {
title
}
}
}
'''
result = {"username":0, "title":0}

r = graph_query(GRAPHQL_URL, query)
assert r.status_code == 200

for i in r.json()['data']['search']:
if 'title' in i:
result['title'] = 1
elif 'username' in i:
result['username'] = 1

assert result['username'] == 1
assert result['title'] == 1

def test_query_audits():
query = '''
query {
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '2.0.12'
VERSION = '2.0.13'

0 comments on commit fc9de5b

Please sign in to comment.