138 | """ % image_url) 139 | 140 | def test_dialog_change_width(self): 141 | """ 142 | Test that changing the width in the cropduster CKEDITOR dialog produces 143 | an image and html with the correct dimensions 144 | """ 145 | self.load_admin(StandaloneArticle) 146 | 147 | with self.open_cropduster_ckeditor_dialog(): 148 | with self.visible_selector('#id_image') as el: 149 | el.send_keys(os.path.join(self.TEST_IMG_DIR, 'img.png')) 150 | with self.clickable_selector('#upload-button') as el: 151 | el.click() 152 | time.sleep(1) 153 | with self.clickable_selector('#id_size-width') as el: 154 | el.send_keys(300) 155 | 156 | self.toggle_caption_checkbox() 157 | self.cropduster_ckeditor_ok() 158 | 159 | if self.is_s3: 160 | time.sleep(5) 161 | 162 | content_html = self.selenium.execute_script('return $("#id_content").val()') 163 | 164 | img_src_matches = re.search(r' src="([^"]+)"', content_html) 165 | self.assertIsNotNone(img_src_matches, "Image not found in content: %s" % content_html) 166 | image_url = img_src_matches.group(1) 167 | image_hash = re.search(r'img/([0-9a-f]+)\.png', image_url).group(1) 168 | 169 | try: 170 | image = Image.objects.get(image='ckeditor/img/original.png') 171 | except Image.DoesNotExist: 172 | raise AssertionError("Image not found in database") 173 | 174 | try: 175 | thumb = Thumb.objects.get(name=image_hash, image=image) 176 | except Thumb.DoesNotExist: 177 | raise AssertionError("Thumb not found in database") 178 | 179 | self.assertEqual( 180 | list(Thumb.objects.all()), [thumb], 181 | "Exactly one Thumb object should have been created") 182 | 183 | with default_storage.open("ckeditor/img/%s.png" % image_hash, mode='rb') as f: 184 | self.assertEqual(PIL.Image.open(f).size, (300, 356)) 185 | 186 | self.assertHTMLEqual( 187 | content_html, 188 | """ 189 |
194 | """ % image_url) 195 | -------------------------------------------------------------------------------- /tests/templates/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |