# Path: cntapp/tests/helpers.py
# def init_test_dirs():
#     """
#     create the dir graph:
#    a     b     c
#     \   |      |
#     ab_a      /
#    /   \    /
# ab_a_a  ab_a_b
#     """
#     a = create_dir('a')
#     b = create_dir('b')
#     c = create_dir('c')
#     ab_a = create_dir('ab_a')
#     ab_a_a = create_dir('ab_a_a')
#     ab_a_b = create_dir('ab_a_b')
# 
#     a.add_sub_dir(ab_a)
#     b.add_sub_dir(ab_a)
#     ab_a.add_sub_dir(ab_a_a).add_sub_dir(ab_a_b)
#     c.add_sub_dir(ab_a_b)


from django.contrib.auth import get_user_model
from django.test import TestCase
from .helpers import init_test_dirs


User = get_user_model()


class DirsCustomTest(TestCase):

    def setUp(self):
        self.username = 'yuancheng'
        self.password = 'secret'
        self.user = User.objects.create_superuser(username=self.username, email='', password=self.password)

    def login(self):
        if not self.client.login(username=self.username, password=self.password):
            self.fail('Admin is not login')

    def test_uses_index_template(self):

# Path: cntapp/tests/helpers.py
# def init_test_dirs():
#     """
#     create the dir graph:
#    a     b     c
#     \   |      |
#     ab_a      /
#    /   \    /
# ab_a_a  ab_a_b
#     """
#     a = create_dir('a')
#     b = create_dir('b')
#     c = create_dir('c')
#     ab_a = create_dir('ab_a')
#     ab_a_a = create_dir('ab_a_a')
#     ab_a_b = create_dir('ab_a_b')
# 
#     a.add_sub_dir(ab_a)
#     b.add_sub_dir(ab_a)
#     ab_a.add_sub_dir(ab_a_a).add_sub_dir(ab_a_b)
#     c.add_sub_dir(ab_a_b)


# Path: cntapp/tests/test_custom_views.py
from django.contrib.auth import get_user_model
from django.test import TestCase
from .helpers import init_test_dirs



User = get_user_model()


class DirsCustomTest(TestCase):

    def setUp(self):
        self.username = 'yuancheng'
        self.password = 'secret'
        self.user = User.objects.create_superuser(username=self.username, email='', password=self.password)

    def login(self):
        if not self.client.login(username=self.username, password=self.password):
            self.fail('Admin is not login')

    def test_uses_index_template(self):

        init_test_dirs()