Fixes #1539
[redakcja.git] / apps / catalogue / tests / __init__.py
old mode 100755 (executable)
new mode 100644 (file)
index 9d0f36f..533a6c5
@@ -1,59 +1,9 @@
-from os.path import abspath, dirname, join
-from nose.tools import *
-from mock import patch
-from django.test import TestCase
-from django.contrib.auth.models import User
-from catalogue.models import Book, BookPublishRecord
-
-
-def get_fixture(path):
-    f_path = join(dirname(abspath(__file__)), 'files', path)
-    with open(f_path) as f:
-        return unicode(f.read(), 'utf-8')
-
-
-class PublishTests(TestCase):
-
-    def setUp(self):
-        self.user = User.objects.create(username='tester')
-        self.text1 = get_fixture('chunk1.xml')
-        self.book = Book.create(self.user, self.text1, slug='test-book')
-
-    @patch('apiclient.api_call')
-    def test_unpublishable(self, api_call):
-        with self.assertRaises(AssertionError):
-            self.book.publish(self.user)
-
-    @patch('apiclient.api_call')
-    def test_publish(self, api_call):
-        self.book[0].head.set_publishable(True)
-        self.book.publish(self.user)
-        api_call.assert_called_with(self.user, 'books/', {"book_xml": self.text1})
-
-    @patch('apiclient.api_call')
-    def test_publish_multiple(self, api_call):
-        self.book[0].head.set_publishable(True)
-        self.book[0].split(slug='part-2')
-        self.book[1].commit(get_fixture('chunk2.xml'))
-        self.book[1].head.set_publishable(True)
-        self.book.publish(self.user)
-        api_call.assert_called_with(self.user, 'books/', {"book_xml": get_fixture('expected.xml')})
-
-
-class ManipulationTests(TestCase):
-
-    def setUp(self):
-        self.user = User.objects.create(username='tester')
-        self.book1 = Book.create(self.user, 'book 1', slug='book1')
-        self.book2 = Book.create(self.user, 'book 2', slug='book2')
-
-    def test_append(self):
-        self.book1.append(self.book2)
-        self.assertEqual(Book.objects.all().count(), 1)
-        self.assertEqual(len(self.book1), 2)
-
-    def test_append_to_self(self):
-        with self.assertRaises(AssertionError):
-            self.book1.append(Book.objects.get(pk=self.book1.pk))
-        self.assertEqual(Book.objects.all().count(), 2)
-        self.assertEqual(len(self.book1), 1)
+# -*- coding: utf-8 -*-
+#
+# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from catalogue.tests.book import *
+from catalogue.tests.gallery import *
+from catalogue.tests.publish import *
+from catalogue.tests.xml_updater import *