# 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
        # Test that a logged in user can get a blank form properly.
        self.client.login(username='testuser0', password='pw')
        response = self.client.get(test_url)
        self.assertEqual(response.status_code, 200)



class ModelTests(TestCase):
    """Test aspects of models."""

    def test_userprofile(self):
        """Test that a userprofile connects properly to a user."""
        new_user = User()
        new_user.username = 'new_user'
        new_user.password = 'new_user_pw'
        new_user.save()

        new_up = UserProfile()
        new_up.user = new_user
        new_up.save()

        self.assertEqual(new_user.userprofile, new_up)


class MyAdminTests(TestCase):
    """Test individual functions in my_admin.py."""

    def test_add_userprofile(self):
        """Make sure new user gets a userprofile."""
        new_user = User.objects.create_user(username='randy', password='pw')

# 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

        # Test that a logged in user can get a blank form properly.
        self.client.login(username='testuser0', password='pw')
        response = self.client.get(test_url)
        self.assertEqual(response.status_code, 200)



class ModelTests(TestCase):
    """Test aspects of models."""

    def test_userprofile(self):
        """Test that a userprofile connects properly to a user."""
        new_user = User()
        new_user.username = 'new_user'
        new_user.password = 'new_user_pw'
        new_user.save()

        new_up = UserProfile()
        new_up.user = new_user
        new_up.save()

        self.assertEqual(new_user.userprofile, new_up)


class MyAdminTests(TestCase):
    """Test individual functions in my_admin.py."""

    def test_add_userprofile(self):
        """Make sure new user gets a userprofile."""
        new_user = User.objects.create_user(username='randy', password='pw')

        my_admin.add_userprofile(new_user)