X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/6bcd99d1af4e97428d441a3e9c37846370020293..bff8ff8102fe26b61205c444d29024cdf6c9f6e7:/apps/catalogue/tests/__init__.py diff --git a/apps/catalogue/tests/__init__.py b/apps/catalogue/tests/__init__.py index 91c3f812..ae7bef7d 100755 --- a/apps/catalogue/tests/__init__.py +++ b/apps/catalogue/tests/__init__.py @@ -93,9 +93,9 @@ class GalleryAppendTests(TestCase): self.book1.chunk_set.create(number=2, title='Second chunk', slug='book 1 / 2') c=self.book1[0] - c.gallery_start=0 + c.gallery_start=1 c=self.book1[1] - c.gallery_start=2 + c.gallery_start=3 self.scandir = join(settings.MEDIA_ROOT, settings.IMAGE_DIR) if not exists(self.scandir): @@ -114,11 +114,16 @@ class GalleryAppendTests(TestCase): self.book2 = Book.create(self.user, 'book 2', slug='book2') self.book2.chunk_set.create(number=2, title='Second chunk of second book', slug='book 2 / 2') + c = self.book2[0] - c.gallery_start = 0 + c.gallery_start = 1 + c.save() c = self.book2[1] - c.gallery_start = 2 - import nose.tools; nose.tools.set_trace() + c.gallery_start = 3 + c.save() + + print "gallery starts:",self.book2[0].gallery_start, self.book2[1].gallery_start + self.make_gallery(self.book1, { '1-0001_1l' : 'aa', '1-0001_2r' : 'bb', @@ -127,7 +132,7 @@ class GalleryAppendTests(TestCase): }) self.make_gallery(self.book2, { - '1-0001_1l' : 'ee', + '1-0001_1l' : 'dd', # the same, should not be moved '1-0001_2r' : 'ff', '2-0002_1l' : 'gg', '2-0002_2r' : 'hh', @@ -136,12 +141,14 @@ class GalleryAppendTests(TestCase): self.book1.append(self.book2) files = listdir(join(self.scandir, self.book1.gallery)) + files.sort() + print files self.assertEqual(files, [ '1-0001_1l', '1-0001_2r', '1-0002_1l', '1-0002_2r', - '2-0001_1l', + # '2-0001_1l', '2-0001_2r', '3-0002_1l', '3-0002_2r', @@ -169,6 +176,7 @@ class GalleryAppendTests(TestCase): self.book1.append(self.book2) files = listdir(join(self.scandir, self.book1.gallery)) + files.sort() print files self.assertEqual(files, [ '0-0001_1l', @@ -183,6 +191,7 @@ class GalleryAppendTests(TestCase): def test_none_indexed(self): + import nose.tools self.book2 = Book.create(self.user, 'book 2', slug='book2') self.make_gallery(self.book1, { '1-0001_1l' : 'aa', @@ -201,6 +210,7 @@ class GalleryAppendTests(TestCase): self.book1.append(self.book2) files = listdir(join(self.scandir, self.book1.gallery)) + files.sort() print files self.assertEqual(files, [ '0-1-0001_1l',