// Copyright 2019 getensh.com. All rights reserved. // Use of this source code is governed by getensh.com. package tests import ( "context" "testing" v1 "adm-vehicle-style/pb/v1" jsoniter "github.com/json-iterator/go" ) var json = jsoniter.ConfigCompatibleWithStandardLibrary func TestSYBrand(t *testing.T) { req := &v1.BrandListRequest{ HasImg: -1, } reply, err := client.BrandList(context.Background(), req) if err != nil { t.Error(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestUpdateSYBrand(t *testing.T) { req := &v1.UpdateSYBrandRequest{ Id: 396, BrandName: "众泰", Initial: "ZT", Weight: 100, Status: 1, } reply, err := client.UpdateSYBrand(context.Background(), req) if err != nil { t.Error(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestMaker(t *testing.T) { req := &v1.GetMakerRequest{ BrandId: "A23", } reply, err := client.GetMaker(context.Background(), req) if err != nil { t.Error(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestUpdateMaker(t *testing.T) { req := &v1.UpdateMakerRequest{ MakerId: "171", Maker: "众泰汽车1", } reply, err := client.UpdateMaker(context.Background(), req) if err != nil { t.Error(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestSeriesList(t *testing.T) { req := &v1.SeriesListRequest{} reply, err := client.SeriesList(context.Background(), req) if err != nil { t.Error(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestUpdateStyleInfo(t *testing.T) { req := &v1.UpdateStyleInfoRequest{ Id: 1, Data: `{"front_wheel_specification":""}`, } reply, err := client.UpdateStyleInfo(context.Background(), req) if err != nil { t.Error(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestMaintain(t *testing.T) { req := v1.MaintainManualRequest{ StyleId: "A020040001", } reply, err := client.MaintainManual(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestItemList(t *testing.T) { req := v1.ItemListRequest{ ItemType: 1, } reply, err := client.ItemList(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestUpdateMaintainManual(t *testing.T) { req := v1.UpdateMaintainManualRequest{ Id: 0, StyleId: "B350020002", StartMile: 100, MileCycle: 100, StartDate: 12, DateCycle: 12, ItemId: 1007, } reply, err := client.UpdateMaintainManual(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestMaintainInfo(t *testing.T) { req := v1.MaintainManualInfoRequest{ StyleId: "A230340070", } reply, err := client.MaintainManualInfo(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestStyleItem(t *testing.T) { req := v1.MaintainManualRequest{ StyleId: "A230340070", } reply, err := client.StyleItem(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestC2Lists(t *testing.T) { req := v1.C2ListRequest{ StyleId: "A090050006", } reply, err := client.C2List(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestUpdateStyleItem(t *testing.T) { req := v1.UpdateStyleItemRequest{ List: []*v1.StyleItem{ { Id: 0, StyleId: "A180030001", C2Id: 0, Useage: "xx", }, { Id: 30, C2Id: 4001, AttributeRule: "0W-30", Useage: "6L", }, }, } reply, err := client.UpdateStyleItem(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestDeleteMaintaince(t *testing.T) { req := v1.DeleteMaintainaceRequest{ Id: 1273, } reply, err := client.DeleteMaintainace(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestSearch(t *testing.T) { req := v1.SearchRequest{ Type: 2, BrandId: "A03", } reply, err := client.Search(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestExportStyle(t *testing.T) { req := v1.ExportStyleRequest{ TaskName: "1", Fields: "alternator,braking_distance_measure,brand_name,brand_id,emission_standard,engine,fast_charge_amount,fast_charging_time,fuel_type_detail,hundred_accelerate,hundred_accelerate_measure,level,lwh,maker,maximum_power,maximum_simulation_milage,maximum_simulation_milage_measure,maximum_speed,maximum_torque,model_year,oil_wear_comrehensive,oil_wear_measure,price,price_yuan,series_id,series_name,slow_charging_time,style_id,style_name,sub_level,vehicle_structure,vehicle_warranty,aircondition_control_type,car_air_purifier,fragrance_system,negative_ion_generator,pm25_device,rear_independent_air_conditioner,rear_seat_air_outlet,refrigerator,temperature_zone_control,back_wheel_distance,door_number,front_wheel_distance,high,long,minimum_ground_clearance,oilbox_volume,seat_number,trunk_volume,unladen_mass,wheelbase,wide,assist_type,back_suspention_type,body_structure,drive_type,front_suspention_type,air_suspension,ascent_assist,auto_hold,automatic_driving_assistance,automatic_parking,back_parking_rador,central_diff_lock,cruise_system,driving_mode_selection,e_induction_suspension,edl,engine_start_stop_technology,front_parking_rador,hdc,overall_active_steering_system,reverse_vehicle_side_warning_system,variable_steering_ratio,variable_suspension,wade_sensing_system,back_electric_maximum_power,back_electric_torque,battery_energy,battery_pack_warranty,battery_type,front_electric_maximum_power,front_electric_torque,hundred_electricity_consumption,motor_layout,motor_number,motor_type,system_integrated_power,system_integrated_torque,total_motor_power,total_motor_torque,air_intak_form,cylinder_arrangement,cylinder_diameter,cylinder_head_material,cylinder_material,cylinder_number,cylinder_valve_number,displacement,displacement_l,engine_technology,engine_type,fuel_lable,maximum_horsepower,maximum_power_rpm,oil_supply_mode,piston_stroke,reduction_ratio,rpm,valve_mechanism,active_intake_grille,battery_pre_heating,central_control_lock,electric_trunk,electronic_anti_theft,eosd,frameless_design_door,hide_electric_door_handle,inductive_trunk,key_type,keyless_entry_system,keyless_start_system,outside_pedal,rear_compartment_position_memory,remote_start,rim_material,roof_luggage_rack,side_sliding_door,skylight_type,sports_appearance_kit,tail,the_tailgate_glass_opens_independently,gear_number,gearbox_desc,gearbox_type,auxiliary_driving_chip,chip_computing_power,number_of_cameras,number_of_lidars,number_of_millimeter_wave_radars,number_of_ultrasonic_radars,active_noise_reduction,car_driving_recorder,driving_computer_display,electrically_adjustable_pedal,full_lcd_dashboard,full_lcd_dashboard_size,hud_rising_number_display,mobile_phone_wireless_charging,multi_functional_steering_wheel,steering_wheel_adjustment,steering_wheel_heating,steering_wheel_material,steering_wheel_remember,steering_wheel_shift,adaptive_far_near,atmosphere,auto_head,clean,daytime,far,fog,headlamp_delay_off,headlamp_rain_fog_mode,height_adjustable,lighting_features,near,side_turn,steering_assist_lamp,touch_reading_lamp,back_lcd,car_internet,car_phone,car_tv,cd_dvd,center_console_large_screen_size,central_colour_screen,central_lcd_split_screen,charging_interface,face_recognition,gesture_control,gps,interface_of12v,mobile_internet,navigation_traffic_information_display,number_of_interfaces,ota,power_of220v,rear_control_multimedia,road_rescue_call,speaker_brand,speaker_number,voice_control,body_colour,interior_color,anti_pinch_hand,back_electric_window,back_side_privacy,back_side_sunshade,back_sunshade,back_wiper,cosmetic,exterior_rearview_mirror_function,front_electric_window,front_wiper,heatable_spray_nozzle,interior_rearview_mirror_function,multilayer_sound_insulation_glass,window_one_key,abs,active_brake,asr_tcs_trc,auxiliary_seat_airbag,back_belt_airbag,back_head_airbag,back_side_airbag,eba_bas_ba,ebd_cbc,esp,fatigue_driving_warning,font_head_airbag,front_middle_airbag,front_side_airbag,iso_fix,knee_airbag,lane_departure_warning_system,lane_keeping,main_seat_airbag,night_vision,parallel_auxiliary,passenger_seat_cushion_airbag,passive_pedestrian_protection,rear_central_airbag,rear_seat_anti_slide_airbag,road_traffic_sign_recognition,run_flat_tire,seat_belt_warning,tire_presure_monitor,auxiliary_adjustable_button,auxiliary_electric_adust,auxiliary_seat_adjustment_mode,back_cup_holder,back_down_type,back_fold_table,back_handrail,electric_seat_remeber,front_handrail,front_seat_function,heating_cooling_cup_holder,main_electric_adust,main_seat_adjustment_mode,rear_seat_electric_adjustment,rear_seat_function,rear_seat_power_down,seat_layout_form,seat_material,second_independent,second_row_seat_adjustment,sport_seat,back_brake_type,back_wheel_specification,front_brake_type,front_wheel_specification,parking_brake_type,spare_wheel_specification", } reply, err := client.ExportStyle(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestExportStyleTask(t *testing.T) { req := v1.EmptyReply{} reply, err := client.ExportStyleTaskList(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestDeleteExportStyleTask(t *testing.T) { req := v1.DeleteExportStyleTaskRequest{ Id: 19, } reply, err := client.DeleteExportStyleTask(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestQuery(t *testing.T) { req := v1.QueryRequest{ Code: "003", Params: `{"series_id": "A23064"}`, } reply, err := client.Query(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestAddTemplateDetails(t *testing.T) { req := v1.AddTemplateDetailRequest{ Tid: 10, ItemId: 1005, StartMile: 1000, StartDate: 12, MileCycle: 1000, DateCycle: 12, Name: "T1", } reply, err := client.AddTemplateDetail(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestTemplateDetail(t *testing.T) { req := v1.TemplateDetailRequest{ Tid: 4, } reply, err := client.TemplateDetail(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestTemplateList(t *testing.T) { req := v1.TemplateListRequest{} reply, err := client.TemplateList(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestTemplateDetailList(t *testing.T) { req := v1.TemplateDetailListRequest{ Page: 3, } reply, err := client.TemplateDetailList(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestUpdateTemplates(t *testing.T) { req := v1.UpdateMaintainManualRequest{ Tid: 4, Name: "12312S", Id: 0, ItemId: 1001, StartMile: 100, StartDate: 6, MileCycle: 100, DateCycle: 6, } reply, err := client.UpdateTemplateDetail(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestChooseTemplateDetail(t *testing.T) { req := v1.ChooseTemplateDetailRequest{ StyleId: "A090050005", Tid: 6, } reply, err := client.ChooseTemplateDetail(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } } func TestTemplateItemList(t *testing.T) { req := v1.TemplateItemListRequest{ ItemType: 1, Tid: 10, } reply, err := client.TemplateItemList(context.Background(), &req) if err != nil { t.Fatal(err) } else { s, _ := json.MarshalToString(reply) t.Log(s) } }