Esempio n. 1
0
    def _assert_model_added_with_attributes(self, attr):
        save_images(u'jackfile', u'bauercontent', self.images)
        assert len(getattr(self, attr)) == 1
        obj = getattr(self, attr)[0]

        assert obj.name == u'jackfile'
        assert obj.url == self.storage.url(u'jackfile')

        assert obj.nail_name == u'jackfile_nail.jpg'
        assert obj.nail_url == self.storage.url(u'jackfile_nail.jpg')

        assert obj.palm_name == u'jackfile_palm.png'
        assert obj.palm_url == self.storage.url(u'jackfile_palm.png')
    def _assert_model_added_with_attributes(self, attr):
        save_images(u'jackfile', u'bauercontent', self.images)
        assert len(getattr(self, attr)) == 1
        obj = getattr(self, attr)[0]

        assert obj.name == u'jackfile'
        assert obj.url == self.storage.url(u'jackfile')

        assert obj.nail_name == u'jackfile_nail.jpg'
        assert obj.nail_url == self.storage.url(u'jackfile_nail.jpg')

        assert obj.palm_name == u'jackfile_palm.png'
        assert obj.palm_url == self.storage.url(u'jackfile_palm.png')
Esempio n. 3
0
    def test_saves_data_and_images_to_storage(self):
        save_images(u'jackfile', u'bauercontent', self.images)

        assert self.storage.exists(u'jackfile')
        assert self.storage.open(u'jackfile').read() == u'bauercontent'

        assert self.storage.exists(u'jackfile_nail.jpg')
        assert (self.storage.open(u'jackfile_nail.jpg').read() ==
                u'nail saved as jpg')

        assert self.storage.exists(u'jackfile_palm.png')
        assert (self.storage.open(u'jackfile_palm.png').read() ==
                u'palm saved as png')
    def test_saves_data_and_images_to_storage(self):
        save_images(u'jackfile', u'bauercontent', self.images)

        assert self.storage.exists(u'jackfile')
        assert self.storage.open(u'jackfile').read() == u'bauercontent'

        assert self.storage.exists(u'jackfile_nail.jpg')
        assert (
            self.storage.open(u'jackfile_nail.jpg').read() ==
            u'nail saved as jpg'
        )

        assert self.storage.exists(u'jackfile_palm.png')
        assert (
            self.storage.open(u'jackfile_palm.png').read() ==
            u'palm saved as png'
        )