#NEWLINE# def test_persistence( ) : #NEWLINE# #INDENT# i1 = InstanceStatus ( 1 , STATUS_OK ) #NEWLINE# chk1 = CheckStatus ( 'dummy' , [ i1 ] , 1 , 2 ) #NEWLINE# c1 = CollectorStatus ( [ chk1 ] ) #NEWLINE# c1 . persist ( ) #NEWLINE# c2 = CollectorStatus . load_latest_status ( ) #NEWLINE# nt . assert_equal ( 1 , len ( c2 . check_statuses ) ) #NEWLINE# chk2 = c2 . check_statuses [ 0 ] #NEWLINE# assert ( chk2 . name == chk1 . name ) #NEWLINE# assert ( chk2 . status == chk2 . status ) #NEWLINE# assert ( chk2 . metric_count == 1 ) #NEWLINE# assert ( chk2 . event_count == 2 )