fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove mismatched html tags
[redakcja.git]
/
apps
/
catalogue
/
tests
/
gallery.py
diff --git
a/apps/catalogue/tests/gallery.py
b/apps/catalogue/tests/gallery.py
index
ad0dfd7
..
47dfae7
100644
(file)
--- a/
apps/catalogue/tests/gallery.py
+++ b/
apps/catalogue/tests/gallery.py
@@
-18,11
+18,10
@@
class GalleryAppendTests(TestCase):
def setUp(self):
self.user = User.objects.create(username='tester')
self.book1 = Book.create(self.user, 'book 1', slug='book1')
def setUp(self):
self.user = User.objects.create(username='tester')
self.book1 = Book.create(self.user, 'book 1', slug='book1')
- self.book1.chunk_set.create(number=2, title='Second chunk',
- slug='book 1 / 2')
- c=self.book1[1]
- c.gallery_start=3
-
+ self.book1.chunk_set.create(number=2, title='Second chunk', slug='book 1 / 2')
+ c = self.book1[1]
+ c.gallery_start = 3
+
self.scandir = join(settings.MEDIA_ROOT, settings.IMAGE_DIR)
if not exists(self.scandir):
makedirs(self.scandir)
self.scandir = join(settings.MEDIA_ROOT, settings.IMAGE_DIR)
if not exists(self.scandir):
makedirs(self.scandir)
@@
-35,31
+34,29
@@
class GalleryAppendTests(TestCase):
f.close()
book.gallery = basename(d)
f.close()
book.gallery = basename(d)
-
def test_both_indexed(self):
self.book2 = Book.create(self.user, 'book 2', slug='book2')
def test_both_indexed(self):
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')
+ self.book2.chunk_set.create(number=2, title='Second chunk of second book', slug='book 2 / 2')
c = self.book2[1]
c.gallery_start = 3
c.save()
c = self.book2[1]
c.gallery_start = 3
c.save()
-
- print "gallery starts:",self.book2[0].gallery_start, self.book2[1].gallery_start
+
+ print "gallery starts:",
self.book2[0].gallery_start, self.book2[1].gallery_start
self.make_gallery(self.book1, {
self.make_gallery(self.book1, {
- '1-0001_1l'
: 'aa',
- '1-0001_2r'
: 'bb',
- '1-0002_1l'
: 'cc',
- '1-0002_2r'
: 'dd',
-
})
+ '1-0001_1l': 'aa',
+ '1-0001_2r': 'bb',
+ '1-0002_1l': 'cc',
+ '1-0002_2r': 'dd',
+ })
self.make_gallery(self.book2, {
self.make_gallery(self.book2, {
- '1-0001_1l'
: 'dd',
# the same, should not be moved
- '1-0001_2r'
: 'ff',
- '2-0002_1l'
: 'gg',
- '2-0002_2r'
: 'hh',
-
})
+ '1-0001_1l'
: 'dd',
# the same, should not be moved
+ '1-0001_2r': 'ff',
+ '2-0002_1l': 'gg',
+ '2-0002_2r': 'hh',
+ })
self.book1.append(self.book2)
self.book1.append(self.book2)
@@
-75,26
+72,25
@@
class GalleryAppendTests(TestCase):
'2-0001_2r',
'3-0002_1l',
'3-0002_2r',
'2-0001_2r',
'3-0002_1l',
'3-0002_2r',
- ])
+ ])
self.assertEqual((4, 6), (self.book1[2].gallery_start, self.book1[3].gallery_start))
self.assertEqual((4, 6), (self.book1[2].gallery_start, self.book1[3].gallery_start))
-
-
+
def test_none_indexed(self):
self.book2 = Book.create(self.user, 'book 2', slug='book2')
self.make_gallery(self.book1, {
def test_none_indexed(self):
self.book2 = Book.create(self.user, 'book 2', slug='book2')
self.make_gallery(self.book1, {
- '0001_1l'
: 'aa',
- '0001_2r'
: 'bb',
- '0002_1l'
: 'cc',
- '0002_2r'
: 'dd',
-
})
+ '0001_1l': 'aa',
+ '0001_2r': 'bb',
+ '0002_1l': 'cc',
+ '0002_2r': 'dd',
+ })
self.make_gallery(self.book2, {
self.make_gallery(self.book2, {
- '0001_1l'
: 'ee',
- '0001_2r'
: 'ff',
- '0002_1l'
: 'gg',
- '0002_2r'
: 'hh',
-
})
+ '0001_1l': 'ee',
+ '0001_2r': 'ff',
+ '0002_1l': 'gg',
+ '0002_2r': 'hh',
+ })
self.book1.append(self.book2)
self.book1.append(self.book2)
@@
-110,25
+106,23
@@
class GalleryAppendTests(TestCase):
'1-0001_2r',
'1-0002_1l',
'1-0002_2r',
'1-0001_2r',
'1-0002_1l',
'1-0002_2r',
- ])
-
+ ])
- def test_none_indexed(self):
- import nose.tools
+ def test_none_indexed2(self):
self.book2 = Book.create(self.user, 'book 2', slug='book2')
self.make_gallery(self.book1, {
self.book2 = Book.create(self.user, 'book 2', slug='book2')
self.make_gallery(self.book1, {
- '1-0001_1l'
: 'aa',
- '1-0001_2r'
: 'bb',
- '1002_1l'
: 'cc',
- '1002_2r'
: 'dd',
-
})
+ '1-0001_1l': 'aa',
+ '1-0001_2r': 'bb',
+ '1002_1l': 'cc',
+ '1002_2r': 'dd',
+ })
self.make_gallery(self.book2, {
self.make_gallery(self.book2, {
- '0001_1l'
: 'ee',
- '0001_2r'
: 'ff',
- '0002_1l'
: 'gg',
- '0002_2r'
: 'hh',
-
})
+ '0001_1l': 'ee',
+ '0001_2r': 'ff',
+ '0002_1l': 'gg',
+ '0002_2r': 'hh',
+ })
self.book1.append(self.book2)
self.book1.append(self.book2)
@@
-144,5
+138,4
@@
class GalleryAppendTests(TestCase):
'1-0001_2r',
'1-0002_1l',
'1-0002_2r',
'1-0001_2r',
'1-0002_1l',
'1-0002_2r',
- ])
-
+ ])