Created
June 30, 2021 15:11
-
-
Save nietzscheson/2ede152e51bb88d5060a6a82cb53a3b1 to your computer and use it in GitHub Desktop.
Override MEDIA_ROOT configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import graphene | |
import json | |
import tempfile | |
import shutil | |
from draphene.factory import PostFactory, UserFactory | |
from django.test import override_settings | |
from graphene_django.utils.testing import GraphQLTestCase | |
MEDIA_ROOT = tempfile.mkdtemp() | |
@override_settings(MEDIA_ROOT=MEDIA_ROOT) | |
class PostTestCase(GraphQLTestCase): | |
GRAPHQL_URL = "/graphql" | |
@classmethod | |
def tearDownClass(cls): | |
shutil.rmtree(MEDIA_ROOT, ignore_errors=True) | |
super().tearDownClass() | |
def test_create(self): | |
post = PostFactory.build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment