Commit ac94d0d9 authored by Ivan Tyagov's avatar Ivan Tyagov

Most of UNG code is part of a UNGDoc skin created during bt5 install in order...

Most of UNG code is part of a UNGDoc skin created during bt5 install in order to not mess with rest of ERP5 UI code.
Adjust test (dirty) accordingly.
parent cd0761f2
......@@ -87,6 +87,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
def testERP5Site_createNewWebDocumentAsAnonymous(self):
"""Test use script ERP5Site_createNewWebDocument as Anonymous User"""
self.logout()
self.changeSkin("UNGDoc")
self.assertRaises(Unauthorized,
self.portal.ERP5Site_createNewWebDocument,
("web_page_template"))
......@@ -97,6 +98,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
self.login("ung_user")
web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page")
self.assertEquals(web_page, None)
self.changeSkin("UNGDoc")
self.portal.ERP5Site_createNewWebDocument("web_page_template")
self.stepTic()
web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page")
......@@ -113,6 +115,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
assignment.open()
self.stepTic()
self.login("ung_user")
self.changeSkin("UNGDoc")
self.portal.ERP5Site_createNewWebDocument("web_table_template")
self.stepTic()
web_table = self.portal.portal_catalog.getResultValue(portal_type="Web Table")
......@@ -121,6 +124,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
self.login("ung_user2")
self.assertEquals(len(self.portal.web_page_module.searchFolder()), 0)
ung_web_site = self.portal.web_site_module.ung
self.changeSkin("UNGDoc")
web_table = ung_web_site.ERP5Site_userFollowUpWebPage("share-Web.Table")
self.stepTic()
self.assertNotEquals(web_table.getFollowUpList(), [])
......@@ -133,15 +137,18 @@ class TestUNGSecurity(ERP5TypeTestCase):
def testBase_updateCalendarEventListWithERP5User(self):
""" Test script Base_updateCalendarEventList with erp5 user"""
self.logout()
self.changeSkin("UNGDoc")
self.assertEquals('{"events": []}',
self.portal.Base_updateCalendarEventList("list"))
self.login("ung_user")
self.changeSkin("UNGDoc")
event_list = json.loads(self.portal.Base_updateCalendarEventList("list"))
self.assertEquals(event_list.get("events"), [])
event = self.portal.event_module.newContent(portal_type="Note")
event.setStartDate(DateTime())
event.setStopDate(DateTime()+1)
self.stepTic()
self.changeSkin("UNGDoc")
event_dict = json.loads(self.portal.Base_updateCalendarEventList("list"))
event_list = event_dict.get("events")
self.assertEquals(event_list[0][-2], "Note")
......@@ -150,6 +157,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
CalendarTitle="One Sample",
portal_type="Web Message")
self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.Base_updateCalendarEventList("add")
self.stepTic()
web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message")
......@@ -160,6 +168,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
title="Buy Coffee",
event_id=web_message.getId())
self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.Base_updateCalendarEventList("update")
self.stepTic()
self.assertEquals(web_message.getTitle(), "Buy Coffee")
......@@ -167,6 +176,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
form_dict = dict(title=web_message.getTitle(),
id=web_message.getId())
self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.Base_updateCalendarEventList("remove")
self.stepTic()
web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message")
......@@ -179,6 +189,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
lastname="My Last Name",
password="ung_password")
self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.ERPSite_createUNGUser()
self.stepTic()
self.login("ERP5TypeTestCase")
......@@ -195,19 +206,23 @@ class TestUNGSecurity(ERP5TypeTestCase):
assignment.open()
self.stepTic()
self.login("ung_user")
self.changeSkin("UNGDoc")
preference_dict = json.loads(self.portal.Base_getPreferencePathList())
self.assertEquals(preference_dict, {u'preference': u'portal_preferences/1'})
self.login("ung_user2")
self.changeSkin("UNGDoc")
preference_dict = json.loads(self.portal.Base_getPreferencePathList())
self.assertEquals(preference_dict, {u'preference': u'portal_preferences/2'})
def testWebPage_shareDocument(self):
""" """
self.login("ung_user")
self.changeSkin("UNGDoc")
self.portal.ERP5Site_createNewWebDocument("web_page_template")
self.stepTic()
web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page")
self.assertEquals(web_page.getValidationState(), "draft")
self.changeSkin("UNGDoc")
response = web_page.WebPage_shareDocument()
self.stepTic()
self.assertEquals(response, "".join((self.portal.absolute_url(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment