Fix unit tests
This commit is contained in:
parent
1ca6cec0a5
commit
a168b3141e
|
|
@ -53,12 +53,8 @@ class CustomAssignmentTestCase(TestCase):
|
|||
module(slug: $slug) {
|
||||
id
|
||||
chapters {
|
||||
edges {
|
||||
node {
|
||||
contentBlocks {
|
||||
contents
|
||||
}
|
||||
}
|
||||
contentBlocks {
|
||||
contents
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +70,8 @@ class CustomAssignmentTestCase(TestCase):
|
|||
|
||||
@staticmethod
|
||||
def get_first_contents(result):
|
||||
return result.get('data').get('module').get('chapters').get('edges')[0].get('node').get('contentBlocks')[0].get('contents')
|
||||
return result.get('data').get('module').get('chapters')[0].get('contentBlocks')[0].get(
|
||||
'contents')
|
||||
|
||||
def test_module_query(self):
|
||||
result = self.query_module()
|
||||
|
|
|
|||
|
|
@ -6,15 +6,11 @@ CONTENT_BLOCK_QUERY = """
|
|||
query ContentBlockQuery($slug: String!) {
|
||||
module(slug: $slug) {
|
||||
chapters {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
contentBlocks {
|
||||
id
|
||||
title
|
||||
type
|
||||
}
|
||||
}
|
||||
id
|
||||
contentBlocks {
|
||||
id
|
||||
title
|
||||
type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +38,7 @@ class ContentBlockTestCase(SkillboxTestCase):
|
|||
})
|
||||
self.assertIsNone(result.get('errors'))
|
||||
module = result.get('data').get('module')
|
||||
content_block = module['chapters']['edges'][0]['node']['contentBlocks'][0]
|
||||
content_block = module['chapters'][0]['contentBlocks'][0]
|
||||
self.assertEqual(content_block['title'], 'Title')
|
||||
self.assertIsNotNone(content_block['type'])
|
||||
|
||||
|
|
|
|||
|
|
@ -54,17 +54,13 @@ query ObjectiveGroupQuery($id: ID!) {
|
|||
...SchoolClassFragment
|
||||
}
|
||||
objectives {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
text
|
||||
hiddenFor {
|
||||
...SchoolClassFragment
|
||||
}
|
||||
visibleFor {
|
||||
...SchoolClassFragment
|
||||
}
|
||||
}
|
||||
id
|
||||
text
|
||||
hiddenFor {
|
||||
...SchoolClassFragment
|
||||
}
|
||||
visibleFor {
|
||||
...SchoolClassFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -307,7 +303,7 @@ class CopyVisibilityForClassesTestCase(TestCase):
|
|||
def test_objective_visibility(self):
|
||||
query, variables = self._objective_group_query()
|
||||
objective_group = self._get_objective_group(self.student2_client, query, variables)
|
||||
objective = objective_group.get('objectives')['edges'][0]['node']
|
||||
objective = objective_group.get('objectives')[0]
|
||||
hidden_for = objective.get('hiddenFor')
|
||||
self.assertTrue(TEMPLATE_CLASS_NAME in map(lambda x: x['name'], hidden_for))
|
||||
self.assertTrue(SYNC_CLASS_NAME not in map(lambda x: x['name'], hidden_for))
|
||||
|
|
@ -315,7 +311,7 @@ class CopyVisibilityForClassesTestCase(TestCase):
|
|||
self._execute_sync()
|
||||
|
||||
objective_group = self._get_objective_group(self.student2_client, query, variables)
|
||||
objective = objective_group.get('objectives')['edges'][0]['node']
|
||||
objective = objective_group.get('objectives')[0]
|
||||
hidden_for = objective.get('hiddenFor')
|
||||
self.assertTrue(TEMPLATE_CLASS_NAME in map(lambda x: x['name'], hidden_for))
|
||||
self.assertTrue(SYNC_CLASS_NAME in map(lambda x: x['name'], hidden_for))
|
||||
|
|
|
|||
|
|
@ -39,12 +39,8 @@ class ObjectiveOrderTestCase(TestCase):
|
|||
query ObjectiveGroupQuery($id: ID!) {
|
||||
objectiveGroup(id: $id) {
|
||||
objectives {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
text
|
||||
}
|
||||
}
|
||||
id
|
||||
text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -55,9 +51,9 @@ class ObjectiveOrderTestCase(TestCase):
|
|||
})
|
||||
|
||||
self.assertIsNone(result.get('errors'))
|
||||
objective_nodes = result.get('data').get('objectiveGroup').get('objectives').get('edges')
|
||||
objective_nodes = result.get('data').get('objectiveGroup').get('objectives')
|
||||
|
||||
objective1, objective2, objective3, objective4 = [node['node'] for node in objective_nodes]
|
||||
objective1, objective2, objective3, objective4 = [node for node in objective_nodes]
|
||||
|
||||
self.assertEqual(objective1.get('text'), 'first')
|
||||
self.assertEqual(objective2.get('text'), 'second')
|
||||
|
|
|
|||
Loading…
Reference in New Issue