~ubuntu-branches/ubuntu/utopic/lazygal/utopic

« back to all changes in this revision

Viewing changes to lazygaltest/test_generators.py

  • Committer: Package Import Robot
  • Author(s): Michal Čihař
  • Date: 2011-11-30 09:24:25 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20111130092425-2jim1l762xdmorz7
Tags: 0.7.1-1
* New upstream release.
  - Patch was merged upstream. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
        def long(): return dest_image['Exif.GPSInfo.GPSLatitude'].value
150
150
        self.assertRaises(KeyError, long)
151
151
 
 
152
    def test_metadata_osize_nopublish(self):
 
153
        config = lazygal.config.LazygalConfig()
 
154
        config.set('webgal', 'publish-metadata', 'No')
 
155
        self.setup_album(config)
 
156
 
 
157
        img_path = self.add_img(self.source_dir, 'md_filled.jpg')
 
158
 
 
159
        # Add some metadata
 
160
        source_image = pyexiv2.ImageMetadata(img_path)
 
161
        source_image.read()
 
162
        dummy_comment = 'nice photo'
 
163
        source_image['Exif.Photo.UserComment'] = dummy_comment
 
164
        source_image.write()
 
165
 
 
166
        # Generate album
 
167
        dest_dir = self.get_working_path()
 
168
        self.album.generate(dest_dir)
 
169
 
 
170
        dest_img_path = os.path.join(dest_dir, 'md_filled_small.jpg')
 
171
        dest_image = pyexiv2.ImageMetadata(dest_img_path)
 
172
        dest_image.read()
 
173
 
 
174
        # Check that metadata is not here for reduced pictures.
 
175
        def com(): return dest_image['Exif.Photo.UserComment'].value
 
176
        self.assertRaises(KeyError, com)
 
177
 
152
178
    def test_resize_rotate_size(self):
153
179
        config = lazygal.config.LazygalConfig()
154
180
        config.set('webgal', 'image-size', 'std=800x600')
182
208
        self.assertEqual(os.path.isfile(os.path.join(dest_dir, 'index.xml')),
183
209
                         True)
184
210
 
 
211
    def test_dirzip(self):
 
212
        config = lazygal.config.LazygalConfig()
 
213
        config.set('webgal', 'dirzip', 'Yes')
 
214
        self.setup_album(config)
 
215
 
 
216
        img_path = self.add_img(self.source_dir, 'img01.jpg')
 
217
        img_path = self.add_img(self.source_dir, 'img02.jpg')
 
218
        dest_dir = self.get_working_path()
 
219
        self.album.generate(dest_dir)
 
220
 
 
221
        self.assertEqual(os.path.isfile(os.path.join(dest_dir, 'src.zip')),
 
222
                         True)
 
223
 
185
224
 
186
225
class TestSpecialGens(LazygalTestGen):
187
226