Skip to content

Commit

Permalink
Merge pull request #49 from jlmadurga/enhacement/delete_integrations
Browse files Browse the repository at this point in the history
delete kik integrations
  • Loading branch information
jlmadurga committed Apr 24, 2016
2 parents b12fcc3 + e36f4d7 commit d144b59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions microbot/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ def delete_cache_env_vars(sender, instance, **kwargs):
def delete_bot_integrations(sender, instance, **kwargs):
if instance.telegram_bot:
instance.telegram_bot.delete()
if instance.kik_bot:
instance.kik_bot.delete()
8 changes: 7 additions & 1 deletion tests/functional/test_bot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from microbot.models import TelegramBot, KikBot
from microbot.models import Bot, TelegramBot, KikBot
from microbot.test import testcases
from django.core.urlresolvers import reverse
from rest_framework import status
Expand Down Expand Up @@ -67,6 +67,12 @@ def test_webhook_domain_auto_site(self):
args, kwargs = mock_setwebhook.call_args
self.assertEqual(1, mock_setwebhook.call_count)
self.assertIn(current_site.domain, kwargs['webhook_url'])

def test_delete_integrations(self):
self.bot.delete()
self.assertEqual(0, Bot.objects.count())
self.assertEqual(0, TelegramBot.objects.count())
self.assertEqual(0, KikBot.objects.count())

@override_settings(MICROBOT_WEBHOOK_DOMAIN='manualdomain.com')
def test_webhook_domain_manually(self):
Expand Down

0 comments on commit d144b59

Please sign in to comment.