# Path: signup/models.py
# def create_signup( email, questions ):
# def update_signup( email, questions ):
# def create_or_update_signup( email, questions ):
# def delete_signup( email, sequence ):
# def _signup2json( signup_db ):
# def get_signup( email, sequence ):
# def get_all_user_signups( email ):
# def get_signup_by_invite_code( invite_code ):
# def get_signups( sequence ):
# def get_signups_for_archiving( sequence ):
# def get_new_signups( ):
# def handle_new_signups( ):
# def add_user_to_global_list( email, sequence ):


from django.test import TestCase
from django.test.client import Client
from mock import patch
from signup import models as signup_models
import math
    }


    @patch('unsubscribe.emails.mailgun.api.send_email')
    def test_unsubscribe(self, *args, **kwargs):
        signup_models.create_signup(**self.SIGNUP_DATA)
        c = Client()
        resp = c.post('/unsubscribe/', self.SIGNUP_DATA)
        self.assertRedirects(resp, '/')
        self.assertTrue(args[0].called)


    @patch('unsubscribe.emails.mailgun.api.send_email')
    def test_non_signed_up_unsubscribe(self, *args, **kwargs):
        c = Client()
        resp = c.post('/unsubscribe/', self.SIGNUP_DATA)
        self.assertFalse(args[0].called)
    

    @patch('unsubscribe.views.unsubscribe_model.unsubscribe_user')
    def test_unsubscribe_confirm(self, *args, **kwargs):
        su = signup_models.create_signup(**self.SIGNUP_DATA)
        c = Client()
        resp = c.post('/unsubscribe/confirm/{0}/'.format(su['key']), self.SIGNUP_DATA)
        self.assertRedirects(resp, '/')
        self.assertTrue(args[0].called)

    
    @patch('unsubscribe.views.unsubscribe_model.unsubscribe_user')
    def test_unsubscribe_confirm_error(self, *args, **kwargs):

# Path: signup/models.py
# def create_signup( email, questions ):
# def update_signup( email, questions ):
# def create_or_update_signup( email, questions ):
# def delete_signup( email, sequence ):
# def _signup2json( signup_db ):
# def get_signup( email, sequence ):
# def get_all_user_signups( email ):
# def get_signup_by_invite_code( invite_code ):
# def get_signups( sequence ):
# def get_signups_for_archiving( sequence ):
# def get_new_signups( ):
# def handle_new_signups( ):
# def add_user_to_global_list( email, sequence ):


# Path: unsubscribe/tests/test_views.py
from django.test import TestCase
from django.test.client import Client
from mock import patch
from signup import models as signup_models
import math

    }


    @patch('unsubscribe.emails.mailgun.api.send_email')
    def test_unsubscribe(self, *args, **kwargs):
        signup_models.create_signup(**self.SIGNUP_DATA)
        c = Client()
        resp = c.post('/unsubscribe/', self.SIGNUP_DATA)
        self.assertRedirects(resp, '/')
        self.assertTrue(args[0].called)


    @patch('unsubscribe.emails.mailgun.api.send_email')
    def test_non_signed_up_unsubscribe(self, *args, **kwargs):
        c = Client()
        resp = c.post('/unsubscribe/', self.SIGNUP_DATA)
        self.assertFalse(args[0].called)
    

    @patch('unsubscribe.views.unsubscribe_model.unsubscribe_user')
    def test_unsubscribe_confirm(self, *args, **kwargs):
        su = signup_models.create_signup(**self.SIGNUP_DATA)
        c = Client()
        resp = c.post('/unsubscribe/confirm/{0}/'.format(su['key']), self.SIGNUP_DATA)
        self.assertRedirects(resp, '/')
        self.assertTrue(args[0].called)

    
    @patch('unsubscribe.views.unsubscribe_model.unsubscribe_user')
    def test_unsubscribe_confirm_error(self, *args, **kwargs):

        su = signup_models.create_signup(**self.SIGNUP_DATA)