# Path: groups/models.py
# def group_uri2id( group_uri ):
# def group_id2uri( group_id ):
# def create_group( address, description, sequence ):
# def _group2json(group_db):
# def get_group( group_uri ):
# def get_groups( sequence=None ):
# def get_member_groups( member_email ):
# def add_group_member( group_uri, member_email ):
# def remove_group_member( group_uri, member_email ):
# def sync_group_with_mailgun( group_uri ):
# 
# 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: signup/randata.py
# def random_email():
# def random_signup():
# def random_data(size):


from django.test import TestCase
from groups import models as group_model
from signup import models as signup_model
from signup import randata
from mock import patch
import random
import math
import models





@patch('signup.models.sequence_model.get_current_sequence_number', lambda: 1)
class SimpleTest(TestCase):
    def test_prepare_groups(self):
        for signup in randata.random_data(1000):
            signup_model.create_or_update_signup(**signup)

        groups = models.prepare_groups(1)

        grouped_users = filter(lambda x: x['questions']['groupRadios'], signup_model.get_signups(1))

        self.assertEquals(len(groups), math.ceil(len(grouped_users)/40.0))


    def test_every_man_is_an_island(self):

# Path: groups/models.py
# def group_uri2id( group_uri ):
# def group_id2uri( group_id ):
# def create_group( address, description, sequence ):
# def _group2json(group_db):
# def get_group( group_uri ):
# def get_groups( sequence=None ):
# def get_member_groups( member_email ):
# def add_group_member( group_uri, member_email ):
# def remove_group_member( group_uri, member_email ):
# def sync_group_with_mailgun( group_uri ):
# 
# 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: signup/randata.py
# def random_email():
# def random_signup():
# def random_data(size):


# Path: grouping/tests.py
from django.test import TestCase
from groups import models as group_model
from signup import models as signup_model
from signup import randata
from mock import patch
import random
import math
import models






@patch('signup.models.sequence_model.get_current_sequence_number', lambda: 1)
class SimpleTest(TestCase):
    def test_prepare_groups(self):
        for signup in randata.random_data(1000):
            signup_model.create_or_update_signup(**signup)

        groups = models.prepare_groups(1)

        grouped_users = filter(lambda x: x['questions']['groupRadios'], signup_model.get_signups(1))

        self.assertEquals(len(groups), math.ceil(len(grouped_users)/40.0))


    def test_every_man_is_an_island(self):

        for signup in randata.random_data(1000):