File tree Expand file tree Collapse file tree 3 files changed +7
-25
lines changed Expand file tree Collapse file tree 3 files changed +7
-25
lines changed Original file line number Diff line number Diff line change @@ -486,29 +486,10 @@ def settings_page():
486
486
datastore .data ['settings' ]['application' ]['notification_title' ] = form .notification_title .data
487
487
datastore .data ['settings' ]['application' ]['notification_body' ] = form .notification_body .data
488
488
489
- if len (form .notification_urls .data ):
490
- import apprise
491
- apobj = apprise .Apprise ()
492
- apobj .debug = True
493
-
494
- # Add each notification
495
- for n in datastore .data ['settings' ]['application' ]['notification_urls' ]:
496
- apobj .add (n )
497
- outcome = apobj .notify (
498
- body = 'Hello from the worlds best and simplest web page change detection and monitoring service!' ,
499
- title = 'Changedetection.io Notification Test' ,
500
- )
501
-
502
- if outcome :
503
- flash ("{} Notification URLs reached." .format (len (form .notification_urls .data )), "notice" )
504
- else :
505
- flash ("One or more Notification URLs failed" , 'error' )
506
-
507
-
508
489
datastore .data ['settings' ]['application' ]['notification_urls' ] = form .notification_urls .data
509
490
datastore .needs_write = True
510
491
511
- if form .trigger_check .data :
492
+ if form .trigger_check .data and len ( form . notification_urls . data ) :
512
493
n_object = {'watch_url' : "Test from changedetection.io!" ,
513
494
'notification_urls' : form .notification_urls .data }
514
495
notification_q .put (n_object )
Original file line number Diff line number Diff line change 86
86
</ span >
87
87
</ div >
88
88
</ div >
89
-
90
- < span class ="pure-form-message-inline "> < label for ="trigger-test-notification " class ="pure-checkbox ">
91
- < input type ="checkbox " id ="trigger-test-notification " name ="trigger-test-notification "> Send test notification on save.</ label >
92
- </ span >
93
-
89
+ < div class ="pure-control-group ">
90
+ {{ render_field(form.trigger_check) }}
91
+ </ div >
94
92
</ div >
95
93
< div class ="pure-control-group ">
96
94
< button type ="submit " class ="pure-button pure-button-primary "> Save</ button >
Original file line number Diff line number Diff line change @@ -94,10 +94,13 @@ def test_check_notification(client, live_server):
94
94
url_for ("settings_page" ),
95
95
data = {"notification_title" : "New ChangeDetection.io Notification - {watch_url}" ,
96
96
"notification_body" : "{base_url}\n {watch_url}\n {preview_url}\n {diff_url}\n {current_snapshot}\n :-)" ,
97
+ "notification_urls" : "json://foobar.com" , #Re #143 should not see that it sent without [test checkbox]
97
98
"minutes_between_check" : 180 },
98
99
follow_redirects = True
99
100
)
100
101
assert b"Settings updated." in res .data
102
+ # Re #143 - should not see this if we didnt hit the test box
103
+ assert b"Notifications queued" not in res .data
101
104
102
105
# Trigger a check
103
106
client .get (url_for ("api_watch_checknow" ), follow_redirects = True )
You can’t perform that action at this time.
0 commit comments