Skip to content

Commit

Permalink
avoid bad pdf generation on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
artragis authored and GerardPaligot committed Mar 22, 2016
1 parent 32915ba commit 0fb9c02
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion zds/tutorialv2/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
SubCategoryFactory, PublishedContentFactory, tricky_text_content, BetaContentFactory
from zds.tutorialv2.models.models_database import PublishableContent, Validation, PublishedContent, ContentReaction, \
ContentRead
from zds.tutorialv2.publication_utils import publish_content
from zds.gallery.factories import UserGalleryFactory
from zds.gallery.models import Image
from zds.forum.factories import ForumFactory, CategoryFactory
from zds.forum.models import Topic, Post, TopicFollowed, TopicRead
from zds.mp.models import PrivateTopic
from django.utils.encoding import smart_text

from zds.tutorialv2.publication_utils import publish_content, Publicator, PublicatorRegistery
from zds.utils.models import HelpWriting, CommentDislike, CommentLike, Alert
from zds.utils.factories import HelpWritingFactory
from zds.utils.templatetags.interventions import interventions_topics
Expand All @@ -46,6 +47,13 @@
overrided_zds_app['content']['extra_content_generation_policy'] = "SYNC"


@PublicatorRegistery.register("pdf")
class FakePDFPublicator(Publicator):
def publish(self, md_file_path, base_name, **kwargs):
with open(md_file_path[:-2] + "pdf", "w") as f:
f.write("plouf")


@override_settings(MEDIA_ROOT=os.path.join(BASE_DIR, 'media-test'))
@override_settings(ZDS_APP=overrided_zds_app)
class ContentTests(TestCase):
Expand Down

0 comments on commit 0fb9c02

Please sign in to comment.