Add unit test
This commit is contained in:
parent
ad560bb4ef
commit
ce9d58ad5c
|
|
@ -0,0 +1,33 @@
|
|||
from graphql.error import GraphQLLocatedError
|
||||
|
||||
from core.tests.base_test import SkillboxTestCase
|
||||
|
||||
TOPIC_QUERY = """
|
||||
query TopicQuery($slug: String!) {
|
||||
topic(slug: $slug) {
|
||||
__typename
|
||||
...on TopicNode {
|
||||
title
|
||||
}
|
||||
...on NotFound {
|
||||
reason
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class ContentBlockTestCase(SkillboxTestCase):
|
||||
def setUp(self) -> None:
|
||||
self.createDefault()
|
||||
self.client = self.get_client()
|
||||
|
||||
def test_topic(self):
|
||||
slug = "non-existing"
|
||||
result = self.client.execute(TOPIC_QUERY, variables={
|
||||
"slug": slug
|
||||
})
|
||||
self.assertIsNone(result.get('errors'))
|
||||
topic = result.get('data').get('topic')
|
||||
self.assertEqual(topic.get('__typename'), 'NotFound')
|
||||
self.assertEqual(topic.get('reason'), 'Not Found')
|
||||
Loading…
Reference in New Issue