30 lines
714 B
Python
30 lines
714 B
Python
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.errors)
|
|
topic = result.data.get("topic")
|
|
self.assertEqual(topic.get("__typename"), "NotFound")
|
|
self.assertEqual(topic.get("reason"), "Not Found")
|