This file contains hidden or 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 logging.config | |
| import os | |
| from django.utils.log import DEFAULT_LOGGING | |
| # Disable Django's logging setup | |
| LOGGING_CONFIG = None | |
| LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper() | |
| logging.config.dictConfig({ |
This file contains hidden or 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
| # Celery/celery.py | |
| from __future__ import absolute_import, unicode_literals | |
| from celery import Celery | |
| app = Celery('celery', | |
| broker='redis://192.168.56.101', | |
| backend='redis://192.168.56.101', | |
| include=['Celery.tasks']) | |
| # Optional configuration, see the application user guide. |
This file contains hidden or 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
| def fun1(): | |
| print('this is fun1') | |
| return True | |
| def fun2(): | |
| print('this is fun2') | |
| return False | |
| if(fun1() or fun2()): | |
| print("Logic Or: return value of fun1() is True, fun2() is never evaluated!") |
This file contains hidden or 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
| from django.test import TestCase | |
| from unittest import mock | |
| from django.urls import reverse | |
| from pay.utils import invokeSum | |
| class TestHello(TestCase): | |
| @mock.patch('pay.views.invokeSum') # invokeSum is imported in hello view | |
| def test_sum(self, mock_sum): | |
| mock_sum.return_value = 30 |