mirror of
https://github.com/caronc/apprise-api.git
synced 2025-08-14 00:38:21 +02:00
APPRISE_CONFIG_LOCK switch added for extra security (#57)
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
from django.test import SimpleTestCase
|
||||
from django.test.utils import override_settings
|
||||
from unittest.mock import patch
|
||||
from ..forms import NotifyForm
|
||||
from ..utils import ConfigCache
|
||||
@ -36,6 +37,20 @@ class StatefulNotifyTests(SimpleTestCase):
|
||||
Test stateless notifications
|
||||
"""
|
||||
|
||||
@override_settings(APPRISE_CONFIG_LOCK=True)
|
||||
def test_stateful_configuration_with_lock(self):
|
||||
"""
|
||||
Test the retrieval of configuration when the lock is set
|
||||
"""
|
||||
# our key to use
|
||||
key = 'test_stateful_with_lock'
|
||||
|
||||
# It doesn't matter if there is or isn't any configuration; when this
|
||||
# flag is set. All that overhead is skipped and we're denied access
|
||||
# right off the bat
|
||||
response = self.client.post('/get/{}'.format(key))
|
||||
assert response.status_code == 403
|
||||
|
||||
@patch('apprise.Apprise.notify')
|
||||
def test_stateful_configuration_io(self, mock_notify):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user