Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Nov 7, 2023
1 parent 31bdd37 commit 3e4d682
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
1 change: 1 addition & 0 deletions base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@ scripts =
[versions]
# Don't use a released version of redturtle.bandi
redturtle.bandi =
setuptools =
85 changes: 42 additions & 43 deletions redturtle/bandi/tests/test_bando_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,100 +8,99 @@


class BandoViewTest(unittest.TestCase):

layer = REDTURTLE_BANDI_INTEGRATION_TESTING

def setUp(self):
self.portal = self.layer['portal']
self.request = self.layer['request']
setRoles(self.portal, TEST_USER_ID, ['Manager'])
self.portal = self.layer["portal"]
self.request = self.layer["request"]
setRoles(self.portal, TEST_USER_ID, ["Manager"])
self.bando = api.content.create(
container=self.portal, type='Bando', title='Bando foo'
container=self.portal, type="Bando", title="Bando foo"
)

def test_bando_views_registered(self):
view = api.content.get_view(
name='bando_view', context=self.bando, request=self.request
name="bando_view", context=self.bando, request=self.request
)
self.assertTrue(view.__name__ == 'bando_view')
self.assertTrue(view.__name__ == "bando_view")

view_right = api.content.get_view(
name='bando_right_view', context=self.bando, request=self.request
name="bando_right_view", context=self.bando, request=self.request
)
self.assertTrue(view_right.__name__ == 'bando_right_view')
self.assertTrue(view_right.__name__ == "bando_right_view")

def test_destinatari_in_view(self):
view = api.content.get_view(
name='bando_view', context=self.bando, request=self.request
name="bando_view", context=self.bando, request=self.request
)
self.assertNotIn('Recipients', view())
self.assertNotIn("Recipients", view())

bando_new = api.content.create(
container=self.portal,
type='Bando',
title='Bando new',
destinatari=['foo', 'bar'],
type="Bando",
title="Bando new",
destinatari=["foo", "bar"],
)
view_new = api.content.get_view(
name='bando_view', context=bando_new, request=self.request
name="bando_view", context=bando_new, request=self.request
)
self.assertIn('Recipients', view_new())
self.assertIn('<li>foo</li>', view_new())
self.assertIn('<li>bar</li>', view_new())
self.assertIn("Recipients", view_new())
self.assertIn("<li>foo</li>", view_new())
self.assertIn("<li>bar</li>", view_new())

def test_destinatari_in_right_view(self):
view = api.content.get_view(
name='bando_right_view', context=self.bando, request=self.request
name="bando_right_view", context=self.bando, request=self.request
)
self.assertNotIn('Recipients', view())
self.assertNotIn("Recipients", view())

bando_new = api.content.create(
container=self.portal,
type='Bando',
title='Bando new',
destinatari=['foo', 'bar'],
type="Bando",
title="Bando new",
destinatari=["foo", "bar"],
)
view_new = api.content.get_view(
name='bando_right_view', context=bando_new, request=self.request
name="bando_right_view", context=bando_new, request=self.request
)
self.assertIn('Recipients', view_new())
self.assertIn('<li>foo</li>', view_new())
self.assertIn('<li>bar</li>', view_new())
self.assertIn("Recipients", view_new())
self.assertIn("<li>foo</li>", view_new())
self.assertIn("<li>bar</li>", view_new())

def test_tipologia_bando_in_view(self):
view = api.content.get_view(
name='bando_view', context=self.bando, request=self.request
name="bando_view", context=self.bando, request=self.request
)

self.assertNotIn('Announcement type', view())
self.assertNotIn("Announcement type", view())

bando_new = api.content.create(
container=self.portal,
type='Bando',
title='Bando new',
tipologia_bando='altro',
type="Bando",
title="Bando new",
tipologia_bando="Altro",
)
view_new = api.content.get_view(
name='bando_view', context=bando_new, request=self.request
name="bando_view", context=bando_new, request=self.request
)
self.assertIn('Announcement type', view_new())
self.assertIn('Altro', view_new())
self.assertIn("Announcement type", view_new())
self.assertIn("Altro", view_new())

def test_tipologia_bando_in_right_view(self):
view = api.content.get_view(
name='bando_right_view', context=self.bando, request=self.request
name="bando_right_view", context=self.bando, request=self.request
)

self.assertNotIn('Announcement type', view())
self.assertNotIn("Announcement type", view())

bando_new = api.content.create(
container=self.portal,
type='Bando',
title='Bando new',
tipologia_bando='altro',
type="Bando",
title="Bando new",
tipologia_bando="Altro",
)
view_new = api.content.get_view(
name='bando_right_view', context=bando_new, request=self.request
name="bando_right_view", context=bando_new, request=self.request
)
self.assertIn('Announcement type', view_new())
self.assertIn('Altro', view_new())
self.assertIn("Announcement type", view_new())
self.assertIn("Altro", view_new())

0 comments on commit 3e4d682

Please sign in to comment.