#NEWLINE# def test_create_new_subscription( self ) : #NEWLINE# #INDENT# payload = { #NEWLINE# #INDENT# 'id' : self . node . _id , #NEWLINE# 'event' : 'comments' , #NEWLINE# 'notification_type' : 'email_transactional' , #NEWLINE# #UNINDENT# } #NEWLINE# url = api_url_for ( 'configure_subscription' ) #NEWLINE# self . app . post_json ( url , payload , auth = self . node . creator . auth ) #NEWLINE# event_id = ( ( self . node . _id + '_' ) + 'comments' ) #NEWLINE# s = NotificationSubscription . find_one ( Q ( '_id' , 'eq' , event_id ) ) #NEWLINE# assert_equal ( payload [ 'id' ] , s . owner . _id ) #NEWLINE# assert_equal ( payload [ 'event' ] , s . event_name ) #NEWLINE# assert_in ( self . node . creator , getattr ( s , payload [ 'notification_type' ] ) ) #NEWLINE# new_payload = { #NEWLINE# #INDENT# 'id' : self . node . _id , #NEWLINE# 'event' : 'comments' , #NEWLINE# 'notification_type' : 'email_digest' , #NEWLINE# #UNINDENT# } #NEWLINE# url = api_url_for ( 'configure_subscription' ) #NEWLINE# self . app . post_json ( url , new_payload , auth = self . node . creator . auth ) #NEWLINE# s . reload ( ) #NEWLINE# assert_false ( ( self . node . creator in getattr ( s , payload [ 'notification_type' ] ) ) ) #NEWLINE# assert_in ( self . node . creator , getattr ( s , new_payload [ 'notification_type' ] ) )