# Path: classphoto/models.py
# def _bio2dict( bio_db ):
# def save_bio( email, sequence, name, bio, avatar, twitter=None, gplus=None):
# def has_bio( email, sequence ):
# def get_bio( email ):
# def get_bios( sequence, limit=100 ):
# def get_bios_by_email( sequence, emails ):
# 
# Path: classphoto/db.py
# class UserBio(models.Model):
# 
# Path: classphoto/emails.py
# def send_user_link( email, key ):
# def send_user_link_to_whole_sequence( sequence ):
# def send_group_photos(sequence):
# 
# 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 mock import patch
from classphoto import models as classphoto_api
from classphoto import db
from classphoto import emails
from signup import models as signup_api

    def test_update_bio(self):
        # create bio
        user_bio = classphoto_api.save_bio(**self.BIO_DATA)

        # bio should now be in primary list of bios
        bios = classphoto_api.get_bios(1)
        f = lambda x: x['email'] == user_bio['email']
        bios = filter(f, bios)
        self.assertEquals(len(bios), 1)
        self.assertEquals(bios[0], user_bio)

        # update bio
        update_data = self.BIO_DATA.copy()
        update_data['bio'] = 'This is the updated BIO'
        updated_bio = classphoto_api.save_bio(**update_data)
       
        # new bio should now be displayed
        bios = classphoto_api.get_bios(1)
        f = lambda x: x['email'] == user_bio['email']
        bios = filter(f, bios)
        self.assertEquals(len(bios), 1)
        self.assertEquals(bios[0], updated_bio)


    def test_send_user_link_to_whole_sequence( self ):
        signup_api.create_signup('mail1@mail.com', {})
        signup_api.create_signup('mail2@mail.com', {})
        signup_api.create_signup('mail3@mail.com', {})
        signup_api.create_signup('mail4@mail.com', {})

# Path: classphoto/models.py
# def _bio2dict( bio_db ):
# def save_bio( email, sequence, name, bio, avatar, twitter=None, gplus=None):
# def has_bio( email, sequence ):
# def get_bio( email ):
# def get_bios( sequence, limit=100 ):
# def get_bios_by_email( sequence, emails ):
# 
# Path: classphoto/db.py
# class UserBio(models.Model):
# 
# Path: classphoto/emails.py
# def send_user_link( email, key ):
# def send_user_link_to_whole_sequence( sequence ):
# def send_group_photos(sequence):
# 
# 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: classphoto/tests/test_model.py
from django.test import TestCase
from mock import patch
from classphoto import models as classphoto_api
from classphoto import db
from classphoto import emails
from signup import models as signup_api


    def test_update_bio(self):
        # create bio
        user_bio = classphoto_api.save_bio(**self.BIO_DATA)

        # bio should now be in primary list of bios
        bios = classphoto_api.get_bios(1)
        f = lambda x: x['email'] == user_bio['email']
        bios = filter(f, bios)
        self.assertEquals(len(bios), 1)
        self.assertEquals(bios[0], user_bio)

        # update bio
        update_data = self.BIO_DATA.copy()
        update_data['bio'] = 'This is the updated BIO'
        updated_bio = classphoto_api.save_bio(**update_data)
       
        # new bio should now be displayed
        bios = classphoto_api.get_bios(1)
        f = lambda x: x['email'] == user_bio['email']
        bios = filter(f, bios)
        self.assertEquals(len(bios), 1)
        self.assertEquals(bios[0], updated_bio)


    def test_send_user_link_to_whole_sequence( self ):
        signup_api.create_signup('mail1@mail.com', {})
        signup_api.create_signup('mail2@mail.com', {})
        signup_api.create_signup('mail3@mail.com', {})
        signup_api.create_signup('mail4@mail.com', {})

        signup_api.create_signup('mail5@mail.com', {})