Commit 1d304fb0 by aagusti

perbaikan model menus

1 parent 9d96bad4
{
"python.formatting.provider": "yapf"
}
\ No newline at end of file \ No newline at end of file
...@@ -22,9 +22,9 @@ class Menus(Base, NamaModel): ...@@ -22,9 +22,9 @@ class Menus(Base, NamaModel):
parent_id = Column(Integer, ForeignKey('public.menus.id')) parent_id = Column(Integer, ForeignKey('public.menus.id'))
level_id = Column(SmallInteger) level_id = Column(SmallInteger)
order_id = Column(SmallInteger) order_id = Column(SmallInteger)
url = Column(String(256)) url = Column(String(256)) # value
icon = Column(String(256)) icon = Column(String(256))
class_name = Column(String(256)) css_class = Column(String(256))
need_login = Column(SmallInteger, server_default="1") need_login = Column(SmallInteger, server_default="1")
permissions = Column(String(128), server_default="") permissions = Column(String(128), server_default="")
title = Column(String(256)) title = Column(String(256))
......
import unittest
from pyramid import testing
from pyramid.paster import get_appsettings
from webtest import TestApp
class MyTest(unittest.TestCase):
def setUp(self):
settings = get_appsettings('test.ini', name='main')
from opensipkd.base import main
self.app = TestApp(main(global_config = None, **settings))
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
class TestHome(MyTest):
def _callFUT(self, context, request):
from opensipkd.base.views import Home
home=Home(request)
return home.view_home()
def test_home(self):
page = testing.DummyResource()
page['IDoExist'] = testing.DummyResource()
context = testing.DummyResource()
context.__parent__ = page
context.__name__ = 'home'
request = testing.DummyRequest()
info = self._callFUT(context, request)
assert info['page'] == context
print(info["page_text"])
\ No newline at end of file \ No newline at end of file
import unittest import unittest
from pyramid import testing from pyramid import testing
from pyramid.paster import get_appsettings
class MyTest(unittest.TestCase): class MyTest(unittest.TestCase):
def setUp(self): def setUp(self):
settings = get_appsettings('../test.ini', name='main')
from opensipkd.base import main
self.app = TestApp(main(global_config = None, **settings))
self.config = testing.setUp() self.config = testing.setUp()
def tearDown(self): def tearDown(self):
...@@ -11,7 +16,7 @@ class MyTest(unittest.TestCase): ...@@ -11,7 +16,7 @@ class MyTest(unittest.TestCase):
def test_view_fn_query_table(self): def test_view_fn_query_table(self):
from pyramid.httpexceptions import HTTPForbidden from pyramid.httpexceptions import HTTPForbidden
from opensipkd.base.models import query_table from opensipkd.models import query_table
res = query_table('routes', ['id']) res = query_table('routes', ['id'])
print(res.first()) print(res.first())
# , [('id', '=', 1)] # , [('id', '=', 1)]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!