Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1d304fb0
authored
Aug 10, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan model menus
1 parent
9d96bad4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
4 deletions
.vscode/settings.json
opensipkd/models/menus.py
tests/test_base.py
tests/test_fungsi.py
.vscode/settings.json
0 → 100644
View file @
1d304fb
{
"python.formatting.provider"
:
"yapf"
}
\ No newline at end of file
\ No newline at end of file
opensipkd/models/menus.py
View file @
1d304fb
...
@@ -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
))
c
lass_name
=
Column
(
String
(
256
))
c
ss_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
))
...
...
tests/test_base.py
0 → 100644
View file @
1d304fb
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
tests/test_fungsi.py
View file @
1d304fb
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)]
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment