Merge branch 'hotfix/snapshots-without-creator' into develop

This commit is contained in:
Ramon Wenger 2022-04-14 16:42:20 +02:00
commit 83024fa198
2 changed files with 11 additions and 1 deletions

View File

@ -168,7 +168,7 @@ class SnapshotNode(DjangoObjectType):
@staticmethod @staticmethod
def resolve_creator(parent, info, **kwargs): def resolve_creator(parent, info, **kwargs):
return f'{parent.creator.first_name} {parent.creator.last_name}' return f'{parent.creator.first_name} {parent.creator.last_name}' if parent.creator else ''
@staticmethod @staticmethod
def resolve_objective_groups(parent, info, **kwargs): def resolve_objective_groups(parent, info, **kwargs):

View File

@ -414,3 +414,13 @@ class SnapshotTestCase(SkillboxTestCase):
} }
}) })
self.assertIsNotNone(result.get('errors')) self.assertIsNotNone(result.get('errors'))
def test_snapshot_without_creator(self):
self.snapshot.creator = None
self.snapshot.shared = True
self.snapshot.save()
result = self.client.execute(MODULE_SNAPSHOTS_QUERY, variables={
"slug": self.slug
})
self.assertIsNone(result.get('errors'))
self.assertEqual(len(result.get('data').get('module').get('snapshots')), 1)