Esempio n. 1
0
    def test_topic_subscription_no_corp_num(self, mock_deliver_hook,
                                            mock_is_reg_valid):
        mock_is_reg_valid.return_value = True

        instance = HookableCredential(topic_status="Topic")

        hook_utils.find_and_fire_hook(self.event_name + "-topic", instance)

        assert not mock_deliver_hook.called
Esempio n. 2
0
    def test_invalid_subscription(self, mock_is_reg_valid):

        mock_is_reg_valid.return_value = True

        with self.assertRaises(Exception):
            instance = HookableCredential(topic_status="Invalid")

            hook_utils.find_and_fire_hook(self.event_name + "-invalid",
                                          instance)
Esempio n. 3
0
    def test_topic_subscription_success(self, mock_deliver_hook,
                                        mock_is_reg_valid):
        mock_is_reg_valid.return_value = True

        instance = HookableCredential(topic_status="Stream", corp_num="123")

        hook_utils.find_and_fire_hook(self.event_name + "-topic", instance)

        mock_is_reg_valid.assert_called_once_with(self.topichook)

        mock_deliver_hook.assert_called_once_with(self.topichook, instance)
Esempio n. 4
0
    def test_new_subscription_success(self, mock_deliver_hook,
                                      mock_is_reg_valid):
        mock_is_reg_valid.return_value = True

        instance = HookableCredential(topic_status="New")

        hook_utils.find_and_fire_hook(self.event_name + "-new", instance)

        mock_is_reg_valid.assert_called_once_with(self.newhook)

        mock_deliver_hook.assert_called_once_with(self.newhook, instance)