#NEWLINE# def test_entity_mgr_create_alarm( self ) : #NEWLINE# #INDENT# ent = self . entity #NEWLINE# mgr = ent . _alarm_manager #NEWLINE# check = self . check #NEWLINE# np = utils . random_unicode ( ) #NEWLINE# criteria = utils . random_unicode ( ) #NEWLINE# disabled = random . choice ( ( True , False ) ) #NEWLINE# label = utils . random_unicode ( ) #NEWLINE# name = utils . random_unicode ( ) #NEWLINE# metadata = utils . random_unicode ( ) #NEWLINE# obj_id = utils . random_unicode ( ) #NEWLINE# fake_resp = fakes . FakeResponse ( ) #NEWLINE# fake_resp . status_code = 201 #NEWLINE# fake_resp . headers [ 'x-object-id' ] = obj_id #NEWLINE# fake_respbody = utils . random_unicode ( ) #NEWLINE# mgr . api . method_post = Mock ( return_value = ( self , fake_respbody ) ) #NEWLINE# mgr . get = Mock ( ) #NEWLINE# exp_uri = ( '/%s' % mgr . uri_base ) #NEWLINE# exp_body = { #NEWLINE# #INDENT# 'check_id' : check . id , #NEWLINE# 'notification_plan_id' : np , #NEWLINE# 'criteria' : criteria , #NEWLINE# 'disabled' : disabled , #NEWLINE# 'label' : label , #NEWLINE# 'metadata' : metadata , #NEWLINE# #UNINDENT# } #NEWLINE# alarm = mgr . create ( check , np , criteria = criteria , disabled = disabled , label = label , name = name , metadata = metadata ) #NEWLINE# mgr . api . method_post . assert_called_once_with ( exp_uri , body = exp_body )