tests: fix coverage for members view
This commit is contained in:
parent
d1de2389a5
commit
bf6bf63e68
|
@ -1,5 +1,7 @@
|
||||||
# -*- coding: utf-8; -*-
|
# -*- coding: utf-8; -*-
|
||||||
|
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
|
|
||||||
from corepos.db.office_op import model as op_model
|
from corepos.db.office_op import model as op_model
|
||||||
|
@ -9,7 +11,7 @@ from wuttaweb.testing import WebTestCase
|
||||||
from wutta_corepos.web.views.corepos import members as mod
|
from wutta_corepos.web.views.corepos import members as mod
|
||||||
|
|
||||||
|
|
||||||
class TestProductView(WebTestCase):
|
class TestMemberView(WebTestCase):
|
||||||
|
|
||||||
def make_view(self):
|
def make_view(self):
|
||||||
return mod.MemberView(self.request)
|
return mod.MemberView(self.request)
|
||||||
|
@ -28,8 +30,11 @@ class TestProductView(WebTestCase):
|
||||||
view = self.make_view()
|
view = self.make_view()
|
||||||
grid = view.make_grid(model_class=view.model_class)
|
grid = view.make_grid(model_class=view.model_class)
|
||||||
self.assertNotIn('first_name', grid.renderers)
|
self.assertNotIn('first_name', grid.renderers)
|
||||||
view.configure_grid(grid)
|
self.assertNotIn('first_name', grid.linked_columns)
|
||||||
|
with patch.object(self.request, 'is_root', new=True):
|
||||||
|
view.configure_grid(grid)
|
||||||
self.assertIn('first_name', grid.renderers)
|
self.assertIn('first_name', grid.renderers)
|
||||||
|
self.assertIn('first_name', grid.linked_columns)
|
||||||
|
|
||||||
def test_render_customer_attr(self):
|
def test_render_customer_attr(self):
|
||||||
view = self.make_view()
|
view = self.make_view()
|
||||||
|
|
Loading…
Reference in a new issue