# Path: gitcms/menus/models.py
# class Menu(models.Model):
#     name = models.CharField(tr('Name'), max_length=255)
#     fake_root = models.ForeignKey(MenuItem)
#     def _get_children(self):
#         return self.fake_root.children.all()
#     children = property(_get_children)
# 
# class MenuItem(models.Model):
#     name = models.CharField(tr('Name'), max_length=255)
#     title = models.CharField(tr('Title'), max_length=255, null=True)
#     url = models.CharField(tr('url'), max_length=255)
#     parent = models.ForeignKey('self', related_name='children', null=True)


import gitcms.menus.load
from gitcms.menus.models import Menu, MenuItem
from os.path import dirname

_basedir = dirname(__file__)
def test_simple_load():
    gitcms.menus.load.loaddir(_basedir + '/data/') 
    assert len(Menu.objects.all())
    assert len(MenuItem.objects.all())

# Path: gitcms/menus/models.py
# class Menu(models.Model):
#     name = models.CharField(tr('Name'), max_length=255)
#     fake_root = models.ForeignKey(MenuItem)
#     def _get_children(self):
#         return self.fake_root.children.all()
#     children = property(_get_children)
# 
# class MenuItem(models.Model):
#     name = models.CharField(tr('Name'), max_length=255)
#     title = models.CharField(tr('Title'), max_length=255, null=True)
#     url = models.CharField(tr('url'), max_length=255)
#     parent = models.ForeignKey('self', related_name='children', null=True)


# Path: gitcms/menus/tests/test_load.py
import gitcms.menus.load
from gitcms.menus.models import Menu, MenuItem
from os.path import dirname


_basedir = dirname(__file__)
def test_simple_load():
    gitcms.menus.load.loaddir(_basedir + '/data/') 
    assert len(Menu.objects.all())
    assert len(MenuItem.objects.all())

    menu = Menu.objects.all()[0]