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): ...@@ -87,6 +87,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
def testERP5Site_createNewWebDocumentAsAnonymous(self): def testERP5Site_createNewWebDocumentAsAnonymous(self):
"""Test use script ERP5Site_createNewWebDocument as Anonymous User""" """Test use script ERP5Site_createNewWebDocument as Anonymous User"""
self.logout() self.logout()
self.changeSkin("UNGDoc")
self.assertRaises(Unauthorized, self.assertRaises(Unauthorized,
self.portal.ERP5Site_createNewWebDocument, self.portal.ERP5Site_createNewWebDocument,
("web_page_template")) ("web_page_template"))
...@@ -97,6 +98,7 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -97,6 +98,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
self.login("ung_user") self.login("ung_user")
web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page") web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page")
self.assertEquals(web_page, None) self.assertEquals(web_page, None)
self.changeSkin("UNGDoc")
self.portal.ERP5Site_createNewWebDocument("web_page_template") self.portal.ERP5Site_createNewWebDocument("web_page_template")
self.stepTic() self.stepTic()
web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page") web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page")
...@@ -113,6 +115,7 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -113,6 +115,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
assignment.open() assignment.open()
self.stepTic() self.stepTic()
self.login("ung_user") self.login("ung_user")
self.changeSkin("UNGDoc")
self.portal.ERP5Site_createNewWebDocument("web_table_template") self.portal.ERP5Site_createNewWebDocument("web_table_template")
self.stepTic() self.stepTic()
web_table = self.portal.portal_catalog.getResultValue(portal_type="Web Table") web_table = self.portal.portal_catalog.getResultValue(portal_type="Web Table")
...@@ -121,6 +124,7 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -121,6 +124,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
self.login("ung_user2") self.login("ung_user2")
self.assertEquals(len(self.portal.web_page_module.searchFolder()), 0) self.assertEquals(len(self.portal.web_page_module.searchFolder()), 0)
ung_web_site = self.portal.web_site_module.ung ung_web_site = self.portal.web_site_module.ung
self.changeSkin("UNGDoc")
web_table = ung_web_site.ERP5Site_userFollowUpWebPage("share-Web.Table") web_table = ung_web_site.ERP5Site_userFollowUpWebPage("share-Web.Table")
self.stepTic() self.stepTic()
self.assertNotEquals(web_table.getFollowUpList(), []) self.assertNotEquals(web_table.getFollowUpList(), [])
...@@ -133,15 +137,18 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -133,15 +137,18 @@ class TestUNGSecurity(ERP5TypeTestCase):
def testBase_updateCalendarEventListWithERP5User(self): def testBase_updateCalendarEventListWithERP5User(self):
""" Test script Base_updateCalendarEventList with erp5 user""" """ Test script Base_updateCalendarEventList with erp5 user"""
self.logout() self.logout()
self.changeSkin("UNGDoc")
self.assertEquals('{"events": []}', self.assertEquals('{"events": []}',
self.portal.Base_updateCalendarEventList("list")) self.portal.Base_updateCalendarEventList("list"))
self.login("ung_user") self.login("ung_user")
self.changeSkin("UNGDoc")
event_list = json.loads(self.portal.Base_updateCalendarEventList("list")) event_list = json.loads(self.portal.Base_updateCalendarEventList("list"))
self.assertEquals(event_list.get("events"), []) self.assertEquals(event_list.get("events"), [])
event = self.portal.event_module.newContent(portal_type="Note") event = self.portal.event_module.newContent(portal_type="Note")
event.setStartDate(DateTime()) event.setStartDate(DateTime())
event.setStopDate(DateTime()+1) event.setStopDate(DateTime()+1)
self.stepTic() self.stepTic()
self.changeSkin("UNGDoc")
event_dict = json.loads(self.portal.Base_updateCalendarEventList("list")) event_dict = json.loads(self.portal.Base_updateCalendarEventList("list"))
event_list = event_dict.get("events") event_list = event_dict.get("events")
self.assertEquals(event_list[0][-2], "Note") self.assertEquals(event_list[0][-2], "Note")
...@@ -150,6 +157,7 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -150,6 +157,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
CalendarTitle="One Sample", CalendarTitle="One Sample",
portal_type="Web Message") portal_type="Web Message")
self.portal.REQUEST.form.update(form_dict) self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.Base_updateCalendarEventList("add") self.portal.Base_updateCalendarEventList("add")
self.stepTic() self.stepTic()
web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message") web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message")
...@@ -160,6 +168,7 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -160,6 +168,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
title="Buy Coffee", title="Buy Coffee",
event_id=web_message.getId()) event_id=web_message.getId())
self.portal.REQUEST.form.update(form_dict) self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.Base_updateCalendarEventList("update") self.portal.Base_updateCalendarEventList("update")
self.stepTic() self.stepTic()
self.assertEquals(web_message.getTitle(), "Buy Coffee") self.assertEquals(web_message.getTitle(), "Buy Coffee")
...@@ -167,6 +176,7 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -167,6 +176,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
form_dict = dict(title=web_message.getTitle(), form_dict = dict(title=web_message.getTitle(),
id=web_message.getId()) id=web_message.getId())
self.portal.REQUEST.form.update(form_dict) self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.Base_updateCalendarEventList("remove") self.portal.Base_updateCalendarEventList("remove")
self.stepTic() self.stepTic()
web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message") web_message = self.portal.portal_catalog.getResultValue(portal_type="Web Message")
...@@ -179,6 +189,7 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -179,6 +189,7 @@ class TestUNGSecurity(ERP5TypeTestCase):
lastname="My Last Name", lastname="My Last Name",
password="ung_password") password="ung_password")
self.portal.REQUEST.form.update(form_dict) self.portal.REQUEST.form.update(form_dict)
self.changeSkin("UNGDoc")
self.portal.ERPSite_createUNGUser() self.portal.ERPSite_createUNGUser()
self.stepTic() self.stepTic()
self.login("ERP5TypeTestCase") self.login("ERP5TypeTestCase")
...@@ -195,19 +206,23 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -195,19 +206,23 @@ class TestUNGSecurity(ERP5TypeTestCase):
assignment.open() assignment.open()
self.stepTic() self.stepTic()
self.login("ung_user") self.login("ung_user")
self.changeSkin("UNGDoc")
preference_dict = json.loads(self.portal.Base_getPreferencePathList()) preference_dict = json.loads(self.portal.Base_getPreferencePathList())
self.assertEquals(preference_dict, {u'preference': u'portal_preferences/1'}) self.assertEquals(preference_dict, {u'preference': u'portal_preferences/1'})
self.login("ung_user2") self.login("ung_user2")
self.changeSkin("UNGDoc")
preference_dict = json.loads(self.portal.Base_getPreferencePathList()) preference_dict = json.loads(self.portal.Base_getPreferencePathList())
self.assertEquals(preference_dict, {u'preference': u'portal_preferences/2'}) self.assertEquals(preference_dict, {u'preference': u'portal_preferences/2'})
def testWebPage_shareDocument(self): def testWebPage_shareDocument(self):
""" """ """ """
self.login("ung_user") self.login("ung_user")
self.changeSkin("UNGDoc")
self.portal.ERP5Site_createNewWebDocument("web_page_template") self.portal.ERP5Site_createNewWebDocument("web_page_template")
self.stepTic() self.stepTic()
web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page") web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page")
self.assertEquals(web_page.getValidationState(), "draft") self.assertEquals(web_page.getValidationState(), "draft")
self.changeSkin("UNGDoc")
response = web_page.WebPage_shareDocument() response = web_page.WebPage_shareDocument()
self.stepTic() self.stepTic()
self.assertEquals(response, "".join((self.portal.absolute_url(), 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