<s> """<STR_LIT>""" <EOL> from datetime import timedelta <EOL> from cloudcafe . common . tools . time import string_to_datetime <EOL> from cloudcafe . compute . common . equality_tools import EqualityTools <EOL> from cloudroast . stacktach . fixtures import StackTachComputeIntegration , StackTachTestAssertionsFixture <EOL> class StackTachDBDeleteServerTests ( StackTachComputeIntegration , <EOL> StackTachTestAssertionsFixture ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> cls . create_server ( ) <EOL> cls . delete_server ( ) <EOL> cls . stacktach_events_for_server ( server = cls . deleted_server ) <EOL> def test_launch_entry_on_create_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . validate_attributes_in_launch_response ( ) <EOL> def test_launch_entry_fields_on_create_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . validate_launch_entry_field_values ( server = self . deleted_server ) <EOL> def test_delete_entry_on_delete_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( len ( self . delete_response . entity ) , <NUM_LIT:1> , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> '<STR_LIT:1>' , <EOL> len ( self . delete_response . entity ) , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( self . delete_response . ok , <EOL> self . msg . format ( "<STR_LIT>" , <NUM_LIT:200> , <EOL> self . delete_response . status_code , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( self . event_delete . id_ , <EOL> self . msg . format ( "<STR_LIT:id>" , <EOL> "<STR_LIT>" , <EOL> self . event_delete . id_ , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( self . event_delete . instance , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> self . event_delete . instance , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( self . event_delete . launched_at , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> self . event_delete . launched_at , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( self . event_delete . deleted_at , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> self . event_delete . deleted_at , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( self . event_delete . raw , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> self . event_delete . raw , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> def test_delete_entry_fields_on_delete_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( self . deleted_server . id , self . event_delete . instance , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> self . deleted_server . id , <EOL> self . event_delete . instance , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( <EOL> EqualityTools . are_datetimes_equal ( <EOL> string_to_datetime ( self . launched_at_created_server ) , <EOL> string_to_datetime ( self . event_delete . launched_at ) , <EOL> timedelta ( seconds = self . leeway ) ) , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> self . launched_at_created_server , <EOL> self . event_delete . launched_at , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> self . assertTrue ( <EOL> EqualityTools . are_datetimes_equal ( <EOL> string_to_datetime ( self . deleted_at ) , <EOL> string_to_datetime ( self . event_delete . deleted_at ) , <EOL> timedelta ( seconds = self . leeway ) ) , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> self . deleted_at , <EOL> self . event_delete . deleted_at , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> def test_launched_earlier_than_deleted_on_delete_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertLess ( <EOL> string_to_datetime ( self . event_delete . launched_at ) , <EOL> string_to_datetime ( self . event_delete . deleted_at ) , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> '<STR_LIT:U+0020>' . join ( [ self . event_delete . launched_at , <EOL> self . event_delete . deleted_at ] ) , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> def test_launched_at_field_match_on_delete_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( self . event_delete . launched_at , <EOL> self . event_launch . launched_at , <EOL> self . msg . format ( <EOL> "<STR_LIT>" , <EOL> self . event_delete . launched_at , <EOL> self . event_launch . launched_at , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> def test_instance_field_on_delete_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( self . event_delete . instance , <EOL> self . event_launch . instance , <EOL> self . msg . format ( "<STR_LIT>" , <EOL> self . event_delete . instance , <EOL> self . event_launch . instance , <EOL> self . delete_response . reason , <EOL> self . delete_response . content ) ) <EOL> def test_no_exist_entry_on_delete_server_response ( self ) : <EOL> """<STR_LIT>""" <EOL> self . validate_no_exists_entry_returned ( ) </s>
