def create_content(self): content = [] response = DynamiteScalingResponse() response.command = DynamiteScalingCommand.SCALE_DOWN response.failure_counter = 2 response.service_instance_name = "apache_service_instance_name" response.service_name = "apache_service_name" response.success = True content.append(response) response = DynamiteScalingResponse() response.command = DynamiteScalingCommand.SCALE_UP response.failure_counter = 0 response.service_instance_name = "apache_service_instance_name" response.service_name = "apache_service_name" response.success = False content.append(response) return content
def test_to_json_string(self): scaling_response = DynamiteScalingResponse() scaling_response.command = DynamiteScalingCommand.SCALE_DOWN scaling_response.failure_counter = 4 scaling_response.service_instance_name = "apache_service_instance_name" scaling_response.service_name = "apache_service_name" scaling_response.success = False scaling_response.message_processed_callback = lambda: None result_json = scaling_response.to_json_string() result_response = DynamiteScalingResponse.from_json_string(result_json, scaling_response.message_processed_callback) assert result_response == scaling_response
def test_to_json_string(self): scaling_response = DynamiteScalingResponse() scaling_response.command = DynamiteScalingCommand.SCALE_DOWN scaling_response.failure_counter = 4 scaling_response.service_instance_name = "apache_service_instance_name" scaling_response.service_name = "apache_service_name" scaling_response.success = False scaling_response.message_processed_callback = lambda: None result_json = scaling_response.to_json_string() result_response = DynamiteScalingResponse.from_json_string( result_json, scaling_response.message_processed_callback) assert result_response == scaling_response