3
Test utilities providing coverage for implementations of Mantissa interfaces.
6
from epsilon.descriptor import requiredAttribute
8
from xmantissa.webtheme import XHTMLDirectoryTheme
11
class XHTMLDirectoryThemeTestsMixin:
13
Mixin defining tests for themes based on L{XHTMLDirectoryTheme}.
15
Mix this in to a L{twisted.trial.unittest.TestCase} and set C{theme} and
18
@ivar theme: An instance of the theme to be tested. Set this.
19
@ivar offering: The offering which includes the theme. Set this.
21
theme = requiredAttribute('theme')
22
offering = requiredAttribute('offering')
24
def test_stylesheet(self):
26
The C{stylesheetLocation} of the theme being tested identifies an
27
existing file beneath the offering's static content path.
29
self.assertTrue(isinstance(self.theme, XHTMLDirectoryTheme))
30
self.assertEqual(self.theme.stylesheetLocation[0], 'static')
31
self.assertEqual(self.theme.stylesheetLocation[1], self.offering.name)
32
path = self.offering.staticContentPath
33
for segment in self.theme.stylesheetLocation[2:]:
34
path = path.child(segment)
35
self.assertTrue(path.exists(),
36
"Indicated stylesheet %r does not exist" % (path,))