-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy path__init__.py
More file actions
63 lines (49 loc) · 2.15 KB
/
__init__.py
File metadata and controls
63 lines (49 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from __future__ import unicode_literals
import logging
import os
from django.conf import settings
from django.test.client import RequestFactory, Client
from django.test.simple import DjangoTestSuiteRunner
# add patch support to built-in django test client
def construct_patch(self, path, data='',
content_type='application/octet-stream', **extra):
"""Construct a PATCH request."""
return self.generic('PATCH', path, data, content_type, **extra)
def send_patch(self, path, data='', content_type='application/octet-stream',
follow=False, **extra):
"""Send a resource to the server using PATCH."""
# FIXME: figure out why we need to reimport Client (otherwise NoneType)
from django.test.client import Client # @Reimport
response = super(Client, self).patch(
path, data=data, content_type=content_type, **extra)
if follow:
response = self._handle_redirects(response, **extra)
return response
RequestFactory.patch = construct_patch
Client.patch = send_patch
class SilentDjangoTestSuiteRunner(DjangoTestSuiteRunner):
"""Prevents api log messages from cluttering the console during tests."""
def run_tests(self, test_labels, extra_tests=None, **kwargs):
"""Run tests with all but critical log messages disabled."""
# hide any log messages less than critical
logging.disable(logging.CRITICAL)
# also, create the log directory
if not os.path.exists(settings.DEIS_LOG_DIR):
os.makedirs(settings.DEIS_LOG_DIR)
return super(SilentDjangoTestSuiteRunner, self).run_tests(
test_labels, extra_tests, **kwargs)
from .test_api_middleware import * # noqa
from .test_app import * # noqa
from .test_auth import * # noqa
from .test_build import * # noqa
from .test_config import * # noqa
from .test_domain import * # noqa
from .test_certificate import * # noqa
from .test_container import * # noqa
from .test_hooks import * # noqa
from .test_key import * # noqa
from .test_perm import * # noqa
from .test_release import * # noqa
from .test_scheduler import * # noqa
from .test_users import * # noqa
from .test_limits import * # noqa