Exemple #1
0
 def test_card_name(self):
     ce = CallbackEvent()
     self.assertEqual(ce.card_name, None)
     ce.event_payload = get_sample_data('createCard', 'text')
     self.assertEqual(
         ce.card_name,
         ce.event_payload['action']['data']['card']['name'])  # noqa
Exemple #2
0
 def test_member_name(self):
     ce = CallbackEvent()
     self.assertEqual(ce.member_name, None)
     ce.event_payload = get_sample_data('createCard', 'text')
     self.assertEqual(
         ce.member_name,
         ce.event_payload['action']['memberCreator']['fullName'])  # noqa
 def test_content_type(self):
     ce = CallbackEvent()
     self.assertEqual(ce.content_type, None)
     ce.event_payload = get_sample_data('addAttachmentToCard', 'text')
     ce.event_type = 'addAttachmentToCard'
     ce.resolve_content_type()
     self.assertEqual(ce.content_type, ce.event_payload['action']['data']
                      ['attachment']['content_type'])  # noqa
Exemple #4
0
 def setUp(self):
     self.webhook = Webhook(auth_token="ABC").save(sync=False)
     self.event = CallbackEvent(webhook=self.webhook,
                                event_type='commentCard').save()
     self.admin = CallbackEventAdmin(CallbackEvent, None)
Exemple #5
0
 def test_list(self):
     ce = CallbackEvent()
     self.assertEqual(ce.list, None)
     ce.event_payload = get_sample_data('createCard', 'text')
     self.assertEqual(ce.list, ce.event_payload['action']['data']['list'])
Exemple #6
0
 def test_member(self):
     ce = CallbackEvent()
     self.assertEqual(ce.action_data, None)
     ce.event_payload = get_sample_data('createCard', 'text')
     self.assertEqual(ce.member,
                      ce.event_payload['action']['memberCreator'])
 def test_resolve_content_type(self):
     ce = CallbackEvent()
     ce.event_payload = get_sample_data('addAttachmentToCard', 'text')
     ce.event_type = 'addAttachmentToCard'
     ce.resolve_content_type()
     self.assertEqual(ce.content_type, "image/jpeg")