Esempio n. 1
0
    def testTag(self):
        provideAdapter(StubAbsoluteURL)
        image = Image()
        fe = ImageData()
        fe.context = image
        fe.request = FakeRequest()

        self.assertEqual(
            fe.tag(),
            '<img src="/img" alt="" height="-1" width="-1" border="0" />')
        self.assertEqual(
            fe.tag(scale=.9, width=10, height=10),
            '<img src="/img" alt="" height="9" width="9" border="0" />')
        self.assertEqual(
            fe.tag(alt="Test Image"), '<img src="/img" alt="Test Image"'
            ' height="-1" width="-1" border="0" />')
        self.assertEqual(
            fe.tag(height=100, width=100),
            '<img src="/img" alt="" height="100" width="100" border="0" />')
        self.assertEqual(
            fe.tag(border=1),
            '<img src="/img" alt="" height="-1" width="-1" border="1" />')
        self.assertEqual(
            fe.tag(css_class="Image"), '<img src="/img" alt=""'
            ' height="-1" width="-1" border="0" class="Image" />')
        self.assertEqual(
            fe.tag(height=100, width="100", border=1, css_class="Image"),
            '<img src="/img" alt=""'
            ' height="100" width="100" class="Image" border="1" />')
Esempio n. 2
0
    def testTag(self):
        """ """

        # We need that, sinc eabsolute_url is not implemented yet.
        def absolute_url():
            return '/img'

        image = Image()
        fe = ImageData()
        fe.context = image
        fe.request = None
        fe.absolute_url = absolute_url

        self.assertEqual(fe.tag(),
            '<img src="/img" alt="" height="-1" width="-1" border="0" />')
        self.assertEqual(fe.tag(alt="Test Image"),
            '<img src="/img" alt="Test Image" '
            'height="-1" width="-1" border="0" />')
        self.assertEqual(fe.tag(height=100, width=100),
            '<img src="/img" alt="" height="100" width="100" border="0" />')
        self.assertEqual(fe.tag(border=1),
            '<img src="/img" alt="" height="-1" width="-1" border="1" />')
        self.assertEqual(fe.tag(css_class="Image"),
            '<img src="/img" alt="" '
            'height="-1" width="-1" border="0" class="Image" />')
        self.assertEqual(fe.tag(height=100, width="100",
                         border=1, css_class="Image"),
            '<img src="/img" alt="" '
            'height="100" width="100" class="Image" border="1" />')
Esempio n. 3
0
 def testData(self):
     """ """
     image = Image('Data')
     id = ImageData()
     id.context = image
     id.request = None
     self.assertEqual(id(), 'Data')
Esempio n. 4
0
    def testTag(self):
        provideAdapter(StubAbsoluteURL)
        image = Image()
        fe = ImageData()
        fe.context = image
        fe.request = FakeRequest()

        self.assertEqual(fe.tag(),
            '<img src="/img" alt="" height="-1" width="-1" border="0" />')
        self.assertEqual(fe.tag(alt="Test Image"),
            '<img src="/img" alt="Test Image" '
            'height="-1" width="-1" border="0" />')
        self.assertEqual(fe.tag(height=100, width=100),
            ('<img src="/img" alt="" height="100" '
                'width="100" border="0" />'))
        self.assertEqual(fe.tag(border=1),
            '<img src="/img" alt="" height="-1" width="-1" border="1" />')
        self.assertEqual(fe.tag(css_class="Image"),
            '<img src="/img" alt="" '
            'height="-1" width="-1" border="0" class="Image" />')
        self.assertEqual(fe.tag(height=100, width="100",
                        border=1, css_class="Image"),
            '<img src="/img" alt="" '
                'height="100" width="100" class="Image" border="1" />')
Esempio n. 5
0
 def testData(self):
     image = Image(b'Data')
     data = ImageData()
     data.context = image
     data.request = None
     self.assertEqual(data(), b'Data')
Esempio n. 6
0
 def testData(self):
     image = Image('Data')
     id = ImageData()
     id.context = image
     id.request = None
     self.assertEqual(id(), 'Data')