source: products/quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/tests/seo_migration.txt @ 3233

Last change on this file since 3233 was 3233, checked in by vmaksymiv, 13 years ago

added plone4.1 compatibility

  • Property svn:eol-style set to native
File size: 4.7 KB
Line 
1Introduction
2============
3
4This is a full-blown functional test. The emphasis here is on testing what
5the user may input and see, and the system is largely tested as a black box.
6We use PloneTestCase to set up this test as well, so we have a full Plone site
7to play with. We *can* inspect the state of the portal, e.g. using
8self.portal and self.folder, but it is often frowned upon since you are not
9treating the system as a black box. Also, if you, for example, log in or set
10roles using calls like self.setRoles(), these are not reflected in the test
11browser, which runs as a separate session.
12
13Being a doctest, we can tell a story here.
14
15First, we must perform some setup. We use the testbrowser that is shipped
16with Five, as this provides proper Zope 2 integration. Most of the
17documentation, though, is in the underlying zope.testbrower package.
18
19    >>> from Products.Five.testbrowser import Browser
20    >>> browser = Browser()
21    >>> portal_url = self.portal.absolute_url()
22
23The following is useful when writing and debugging testbrowser tests. It lets
24us see all error messages in the error_log.
25
26    >>> self.portal.error_log._ignored_exceptions = ()
27
28With that in place, we can go to the portal front page and log in. We will
29do this using the default user from PloneTestCase:
30
31    >>> from Products.PloneTestCase.setup import portal_owner, default_password
32    >>> browser.open(portal_url)
33
34We have the login portlet, so let's use that.
35
36    >>> browser.open('http://nohost/plone/login_form')
37    >>> browser.getControl('Login Name').value = portal_owner
38    >>> browser.getControl('Password').value = default_password
39    >>> browser.getControl('Log in').click()
40    >>> "You are now logged in" in browser.contents
41    True
42    >>> "Login failed" in browser.contents
43    False
44    >>> browser.url
45    'http://nohost/plone/login_form'
46
47
48-*- extra stuff goes here -*-
49Test 'SEO Properties' action
50===============================
51
52Define some general objects:
53
54    >>> qi = self.portal.portal_quickinstaller
55    >>> object_tabs = self.portal.portal_actions.object
56    >>> ps = self.portal.portal_setup
57
58Test is 'SEO Properties' action present for a Page before
59seoptimizer installed
60
61    >>> browser.open('http://nohost/plone/front-page')
62    >>> "SEO Properties" in browser.contents
63    False
64
65Now install the product for following testing, and add
66    >>> from quintagroup.seoptimizer.config import PROJECT_NAME
67    >>> qi.installProduct(PROJECT_NAME)
68    'Ran all install steps.'
69    >>> sp = self.portal.portal_properties.seo_properties
70
71And check is SEOProperties added to object tabs
72 
73   >>> object_tabs.get('SEOProperties', None) is not None
74    True
75
76Test visibility 'SEO Properties' action after installation
77
78    >>> sp.content_types_with_seoproperties = ('Document',)
79    >>> browser.open('http://nohost/plone/front-page')
80    >>> "SEO Properties" in browser.contents
81    True
82    >>> browser.getLink('SEO Properties').url
83    'http://nohost/plone/front-page/@@seo-context-properties'
84
85Test invisibility 'SEO Properties' action after installation
86
87    >>> sp.content_types_with_seoproperties = ('File',)
88    >>> browser.open('http://nohost/plone/front-page')
89    >>> "SEO Properties" in browser.contents
90    False
91
92Test reinstallation 'SEO Properties' action
93For perform all upgrade steps on re-installation, earlier version of profile must be set.
94
95    >>> browser.open('http://nohost/plone/front-page')
96    >>> "SEO Properties" in browser.contents
97    False
98    >>> ps.setLastVersionForProfile('quintagroup.seoptimizer:default', '2.0.0')
99    >>> qi.reinstallProducts((PROJECT_NAME,))
100    >>> self.portal.portal_actions.object.get('SEOProperties', None) is not None
101    True
102
103Test visibility 'SEO Properties' action after reinstallation
104
105    >>> sp.content_types_with_seoproperties = ('Document',)
106    >>> browser.open('http://nohost/plone/front-page')
107    >>> "SEO Properties" in browser.contents
108    True
109    >>> browser.getLink('SEO Properties').url
110    'http://nohost/plone/front-page/@@seo-context-properties'
111
112Test invisibility 'SEO Properties' action after reinstallation
113
114    >>> sp.content_types_with_seoproperties = ('File',)
115    >>> browser.open('http://nohost/plone/front-page')
116    >>> "SEO Properties" in browser.contents
117    False
118
119Test uninstallation 'SEO Properties' action
120
121    >>> sp.content_types_with_seoproperties = ('Document',)
122    >>> browser.open('http://nohost/plone/front-page')
123    >>> "SEO Properties" in browser.contents
124    True
125    >>> qi.uninstallProducts((PROJECT_NAME,))
126    >>> object_tabs.get('SEOProperties', None) is not None
127    False
128
129Test visibility 'SEO Properties' action after uninstallation
130
131    >>> sp.content_types_with_seoproperties = ('Document',)
132    >>> browser.open('http://nohost/plone/front-page')
133    >>> "SEO Properties" in browser.contents
134    False
Note: See TracBrowser for help on using the repository browser.