#NEWLINE# def test_add_daily_rule( self ) : #NEWLINE# #INDENT# 'JRPC test: (D) cfg.gs.channel.addRule, cfg.gs.channel.removeRule\n        Should correctly add a DAILY rule to the system.\n        ' #NEWLINE# if self . __verbose_testing : #NEWLINE# #INDENT# print ( '>>> TEST (test_gs_channel_add_rule)' ) #NEWLINE# #UNINDENT# now = misc . get_now_utc ( ) #NEWLINE# r_1_s_time = ( now + datetime . timedelta ( minutes = 30 ) ) #NEWLINE# r_1_e_time = ( now + datetime . timedelta ( minutes = 45 ) ) #NEWLINE# rule_cfg = db_tools . create_jrpc_daily_rule ( starting_time = r_1_s_time , ending_time = r_1_e_time ) #NEWLINE# rule_pk = jrpc_rules . add_rule ( self . __gs_1_id , rule_cfg ) #NEWLINE# rules_g1c1 = jrpc_rules . list_channel_rules ( self . __gs_1_id ) #NEWLINE# expected_r = { #NEWLINE# #INDENT# jrpc_serial . RULE_PK_K : r_1_e_time , #NEWLINE# jrpc_serial . RULE_PERIODICITY : jrpc_serial . RULE_PERIODICITY_DAILY , #NEWLINE# jrpc_serial . RULE_OP : jrpc_serial . RULE_OP_ADD , #NEWLINE# jrpc_serial . RULE_DATES : { #NEWLINE# #INDENT# jrpc_serial . RULE_DAILY_I_DATE : common_serial . serialize_iso8601_date ( ( misc . get_today_utc ( ) + datetime . timedelta ( days = 1 ) ) ) , #NEWLINE# jrpc_serial . RULE_DAILY_F_DATE : common_serial . serialize_iso8601_date ( ( misc . get_today_utc ( ) + datetime . timedelta ( days = 366 ) ) ) , #NEWLINE# jrpc_serial . RULE_S_TIME : common_serial . serialize_iso8601_time ( r_1_s_time ) , #NEWLINE# jrpc_serial . RULE_E_TIME : common_serial . serialize_iso8601_time ( r_1_e_time ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# if self . __verbose_testing : #NEWLINE# #INDENT# print ( ( ( '>>> rules from JRPC[' + str ( len ( rules_g1c1 ) ) ) + ']:' ) ) #NEWLINE# for r in rules_g1c1 : #NEWLINE# #INDENT# misc . print_dictionary ( r ) #NEWLINE# #UNINDENT# print ( '>>> expected_r:' ) #NEWLINE# misc . print_dictionary ( expected_r ) #NEWLINE# #UNINDENT# self . assertEqual ( rules_g1c1 [ 0 ] , expected_r )