-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logging improvements and code tidying
- Loading branch information
Showing
7 changed files
with
492 additions
and
168 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,10 @@ | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
from django.test import SimpleTestCase | ||
from django.core.exceptions import RequestDataTooBig | ||
from apprise import ConfigFormat | ||
from unittest.mock import patch | ||
from unittest import mock | ||
from django.test.utils import override_settings | ||
from ..forms import AUTO_DETECT_CONFIG_KEYWORD | ||
import json | ||
|
@@ -139,6 +141,18 @@ def test_save_config_by_urls(self): | |
) | ||
assert response.status_code == 200 | ||
|
||
with mock.patch('json.loads') as mock_loads: | ||
mock_loads.side_effect = RequestDataTooBig() | ||
# Send our notification by specifying the tag in the parameters | ||
response = self.client.post( | ||
'/add/{}'.format(key), | ||
data=json.dumps({'urls': 'mailto://user:[email protected]'}), | ||
content_type='application/json', | ||
) | ||
|
||
# Our notification failed | ||
assert response.status_code == 431 | ||
|
||
# Test with JSON (and no payload provided) | ||
response = self.client.post( | ||
'/add/{}'.format(key), | ||
|
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
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
Oops, something went wrong.