# Path: competencies/models.py
# class Organization(models.Model):
#     name = models.CharField(max_length=500)
#     org_type = models.CharField(max_length=500, default='school')
#     public = models.BooleanField(default=False)
#     owner = models.ForeignKey(User)
#     editors = models.ManyToManyField(User, related_name='org_editors')
# 
#     # Allow organizations to rename taxonomy elements.
#     alias_sa = models.CharField(max_length=500, default='subject area')
#     alias_sda = models.CharField(max_length=500, default='subdiscipline area')
#     alias_ca = models.CharField(max_length=500, default='competency area')
#     alias_eu = models.CharField(max_length=500, default='essential understanding')
#     alias_lt = models.CharField(max_length=500, default='learning target')
# 
#     class Meta:
#         unique_together = ('name', 'owner',)
# 
#     def __str__(self):
#         return self.name
# 
# Path: competencies/my_admin.py
# def add_userprofile(user):
# def initialize_data():
# def build_test_schools(num_elements=2):
# 
# Path: competencies/utils.py
# def cascade_visibility_down(element, visibility_mode):
# def cascade_public_up(element):
# def fork_organization(forking_org, original_org):
# 
# Path: competencies/my_admin.py
# def add_userprofile(user):
# def initialize_data():
# def build_test_schools(num_elements=2):


from random import choice
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from users.models import *
from competencies.models import Organization
from competencies import my_admin, utils
from competencies import my_admin
        self.num_elements = 2
        self.client = Client()

        # Create 2 test users.
        self.test_user_0 = User.objects.create_user(username='testuser0', password='pw')
        new_up = UserProfile(user=self.test_user_0)
        new_up.save()

        self.test_user_1 = User.objects.create_user(username='testuser1', password='pw')
        new_up = UserProfile(user=self.test_user_1)
        new_up.save()

        # Empty lists of elements.
        self.test_organizations = []

        # Increment for every element created.
        #   Ensures a unique name for every element, which makes testing some behaviors easier.
        self.element_number = 0

    def build_to_organizations(self):
        """Build out system to the organization level."""
        # Build a test organization that user 0 is associated with,
        #  and one that user 1 is associated with.
        # If a test only needs one org, it can set self.num_orgs = 1.
        for organization_num in range(2):
            name = "Test Organization %d" % organization_num
            if organization_num < self.num_orgs/2:
                new_organization = Organization.objects.create(name=name, owner=self.test_user_0)
                new_organization.editors.add(self.test_user_0)
            else:

# Path: competencies/models.py
# class Organization(models.Model):
#     name = models.CharField(max_length=500)
#     org_type = models.CharField(max_length=500, default='school')
#     public = models.BooleanField(default=False)
#     owner = models.ForeignKey(User)
#     editors = models.ManyToManyField(User, related_name='org_editors')
# 
#     # Allow organizations to rename taxonomy elements.
#     alias_sa = models.CharField(max_length=500, default='subject area')
#     alias_sda = models.CharField(max_length=500, default='subdiscipline area')
#     alias_ca = models.CharField(max_length=500, default='competency area')
#     alias_eu = models.CharField(max_length=500, default='essential understanding')
#     alias_lt = models.CharField(max_length=500, default='learning target')
# 
#     class Meta:
#         unique_together = ('name', 'owner',)
# 
#     def __str__(self):
#         return self.name
# 
# Path: competencies/my_admin.py
# def add_userprofile(user):
# def initialize_data():
# def build_test_schools(num_elements=2):
# 
# Path: competencies/utils.py
# def cascade_visibility_down(element, visibility_mode):
# def cascade_public_up(element):
# def fork_organization(forking_org, original_org):
# 
# Path: competencies/my_admin.py
# def add_userprofile(user):
# def initialize_data():
# def build_test_schools(num_elements=2):


# Path: users/tests.py
from random import choice
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from users.models import *
from competencies.models import Organization
from competencies import my_admin, utils
from competencies import my_admin

        self.num_elements = 2
        self.client = Client()

        # Create 2 test users.
        self.test_user_0 = User.objects.create_user(username='testuser0', password='pw')
        new_up = UserProfile(user=self.test_user_0)
        new_up.save()

        self.test_user_1 = User.objects.create_user(username='testuser1', password='pw')
        new_up = UserProfile(user=self.test_user_1)
        new_up.save()

        # Empty lists of elements.
        self.test_organizations = []

        # Increment for every element created.
        #   Ensures a unique name for every element, which makes testing some behaviors easier.
        self.element_number = 0

    def build_to_organizations(self):
        """Build out system to the organization level."""
        # Build a test organization that user 0 is associated with,
        #  and one that user 1 is associated with.
        # If a test only needs one org, it can set self.num_orgs = 1.
        for organization_num in range(2):
            name = "Test Organization %d" % organization_num
            if organization_num < self.num_orgs/2:
                new_organization = Organization.objects.create(name=name, owner=self.test_user_0)
                new_organization.editors.add(self.test_user_0)
            else:

                new_organization = Organization.objects.create(name=name, owner=self.test_user_1)