v1_test.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package tests
  4. import (
  5. "context"
  6. "testing"
  7. v1 "adm-vehicle-style/pb/v1"
  8. jsoniter "github.com/json-iterator/go"
  9. )
  10. var json = jsoniter.ConfigCompatibleWithStandardLibrary
  11. func TestSYBrand(t *testing.T) {
  12. req := &v1.BrandListRequest{
  13. HasImg: -1,
  14. }
  15. reply, err := client.BrandList(context.Background(), req)
  16. if err != nil {
  17. t.Error(err)
  18. } else {
  19. s, _ := json.MarshalToString(reply)
  20. t.Log(s)
  21. }
  22. }
  23. func TestUpdateSYBrand(t *testing.T) {
  24. req := &v1.UpdateSYBrandRequest{
  25. Id: 396,
  26. BrandName: "众泰",
  27. Initial: "ZT",
  28. Weight: 100,
  29. Status: 1,
  30. }
  31. reply, err := client.UpdateSYBrand(context.Background(), req)
  32. if err != nil {
  33. t.Error(err)
  34. } else {
  35. s, _ := json.MarshalToString(reply)
  36. t.Log(s)
  37. }
  38. }
  39. func TestMaker(t *testing.T) {
  40. req := &v1.GetMakerRequest{
  41. BrandId: "A23",
  42. }
  43. reply, err := client.GetMaker(context.Background(), req)
  44. if err != nil {
  45. t.Error(err)
  46. } else {
  47. s, _ := json.MarshalToString(reply)
  48. t.Log(s)
  49. }
  50. }
  51. func TestUpdateMaker(t *testing.T) {
  52. req := &v1.UpdateMakerRequest{
  53. MakerId: "171",
  54. Maker: "众泰汽车1",
  55. }
  56. reply, err := client.UpdateMaker(context.Background(), req)
  57. if err != nil {
  58. t.Error(err)
  59. } else {
  60. s, _ := json.MarshalToString(reply)
  61. t.Log(s)
  62. }
  63. }
  64. func TestSeriesList(t *testing.T) {
  65. req := &v1.SeriesListRequest{}
  66. reply, err := client.SeriesList(context.Background(), req)
  67. if err != nil {
  68. t.Error(err)
  69. } else {
  70. s, _ := json.MarshalToString(reply)
  71. t.Log(s)
  72. }
  73. }
  74. func TestUpdateStyleInfo(t *testing.T) {
  75. req := &v1.UpdateStyleInfoRequest{
  76. Id: 1,
  77. Data: `{"front_wheel_specification":""}`,
  78. }
  79. reply, err := client.UpdateStyleInfo(context.Background(), req)
  80. if err != nil {
  81. t.Error(err)
  82. } else {
  83. s, _ := json.MarshalToString(reply)
  84. t.Log(s)
  85. }
  86. }
  87. func TestMaintain(t *testing.T) {
  88. req := v1.MaintainManualRequest{
  89. StyleId: "A020040001",
  90. }
  91. reply, err := client.MaintainManual(context.Background(), &req)
  92. if err != nil {
  93. t.Fatal(err)
  94. } else {
  95. s, _ := json.MarshalToString(reply)
  96. t.Log(s)
  97. }
  98. }
  99. func TestItemList(t *testing.T) {
  100. req := v1.ItemListRequest{
  101. ItemType: 1,
  102. }
  103. reply, err := client.ItemList(context.Background(), &req)
  104. if err != nil {
  105. t.Fatal(err)
  106. } else {
  107. s, _ := json.MarshalToString(reply)
  108. t.Log(s)
  109. }
  110. }
  111. func TestUpdateMaintainManual(t *testing.T) {
  112. req := v1.UpdateMaintainManualRequest{
  113. Id: 0,
  114. StyleId: "B350020002",
  115. StartMile: 100,
  116. MileCycle: 100,
  117. StartDate: 12,
  118. DateCycle: 12,
  119. ItemId: 1007,
  120. }
  121. reply, err := client.UpdateMaintainManual(context.Background(), &req)
  122. if err != nil {
  123. t.Fatal(err)
  124. } else {
  125. s, _ := json.MarshalToString(reply)
  126. t.Log(s)
  127. }
  128. }
  129. func TestMaintainInfo(t *testing.T) {
  130. req := v1.MaintainManualInfoRequest{
  131. StyleId: "A230340070",
  132. }
  133. reply, err := client.MaintainManualInfo(context.Background(), &req)
  134. if err != nil {
  135. t.Fatal(err)
  136. } else {
  137. s, _ := json.MarshalToString(reply)
  138. t.Log(s)
  139. }
  140. }
  141. func TestStyleItem(t *testing.T) {
  142. req := v1.MaintainManualRequest{
  143. StyleId: "A230340070",
  144. }
  145. reply, err := client.StyleItem(context.Background(), &req)
  146. if err != nil {
  147. t.Fatal(err)
  148. } else {
  149. s, _ := json.MarshalToString(reply)
  150. t.Log(s)
  151. }
  152. }
  153. func TestC2Lists(t *testing.T) {
  154. req := v1.C2ListRequest{
  155. StyleId: "A090050006",
  156. }
  157. reply, err := client.C2List(context.Background(), &req)
  158. if err != nil {
  159. t.Fatal(err)
  160. } else {
  161. s, _ := json.MarshalToString(reply)
  162. t.Log(s)
  163. }
  164. }
  165. func TestUpdateStyleItem(t *testing.T) {
  166. req := v1.UpdateStyleItemRequest{
  167. List: []*v1.StyleItem{
  168. {
  169. Id: 0,
  170. StyleId: "A180030001",
  171. C2Id: 0,
  172. Useage: "xx",
  173. }, {
  174. Id: 30,
  175. C2Id: 4001,
  176. AttributeRule: "0W-30",
  177. Useage: "6L",
  178. },
  179. },
  180. }
  181. reply, err := client.UpdateStyleItem(context.Background(), &req)
  182. if err != nil {
  183. t.Fatal(err)
  184. } else {
  185. s, _ := json.MarshalToString(reply)
  186. t.Log(s)
  187. }
  188. }
  189. func TestDeleteMaintaince(t *testing.T) {
  190. req := v1.DeleteMaintainaceRequest{
  191. Id: 1273,
  192. }
  193. reply, err := client.DeleteMaintainace(context.Background(), &req)
  194. if err != nil {
  195. t.Fatal(err)
  196. } else {
  197. s, _ := json.MarshalToString(reply)
  198. t.Log(s)
  199. }
  200. }
  201. func TestSearch(t *testing.T) {
  202. req := v1.SearchRequest{
  203. Type: 2,
  204. BrandId: "A03",
  205. }
  206. reply, err := client.Search(context.Background(), &req)
  207. if err != nil {
  208. t.Fatal(err)
  209. } else {
  210. s, _ := json.MarshalToString(reply)
  211. t.Log(s)
  212. }
  213. }
  214. func TestExportStyle(t *testing.T) {
  215. req := v1.ExportStyleRequest{
  216. TaskName: "1",
  217. 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",
  218. }
  219. reply, err := client.ExportStyle(context.Background(), &req)
  220. if err != nil {
  221. t.Fatal(err)
  222. } else {
  223. s, _ := json.MarshalToString(reply)
  224. t.Log(s)
  225. }
  226. }
  227. func TestExportStyleTask(t *testing.T) {
  228. req := v1.EmptyReply{}
  229. reply, err := client.ExportStyleTaskList(context.Background(), &req)
  230. if err != nil {
  231. t.Fatal(err)
  232. } else {
  233. s, _ := json.MarshalToString(reply)
  234. t.Log(s)
  235. }
  236. }
  237. func TestDeleteExportStyleTask(t *testing.T) {
  238. req := v1.DeleteExportStyleTaskRequest{
  239. Id: 19,
  240. }
  241. reply, err := client.DeleteExportStyleTask(context.Background(), &req)
  242. if err != nil {
  243. t.Fatal(err)
  244. } else {
  245. s, _ := json.MarshalToString(reply)
  246. t.Log(s)
  247. }
  248. }
  249. func TestQuery(t *testing.T) {
  250. req := v1.QueryRequest{
  251. Code: "003",
  252. Params: `{"series_id": "A23064"}`,
  253. }
  254. reply, err := client.Query(context.Background(), &req)
  255. if err != nil {
  256. t.Fatal(err)
  257. } else {
  258. s, _ := json.MarshalToString(reply)
  259. t.Log(s)
  260. }
  261. }
  262. func TestAddTemplateDetails(t *testing.T) {
  263. req := v1.AddTemplateDetailRequest{
  264. Tid: 10,
  265. ItemId: 1005,
  266. StartMile: 1000,
  267. StartDate: 12,
  268. MileCycle: 1000,
  269. DateCycle: 12,
  270. Name: "T1",
  271. }
  272. reply, err := client.AddTemplateDetail(context.Background(), &req)
  273. if err != nil {
  274. t.Fatal(err)
  275. } else {
  276. s, _ := json.MarshalToString(reply)
  277. t.Log(s)
  278. }
  279. }
  280. func TestTemplateDetail(t *testing.T) {
  281. req := v1.TemplateDetailRequest{
  282. Tid: 4,
  283. }
  284. reply, err := client.TemplateDetail(context.Background(), &req)
  285. if err != nil {
  286. t.Fatal(err)
  287. } else {
  288. s, _ := json.MarshalToString(reply)
  289. t.Log(s)
  290. }
  291. }
  292. func TestTemplateList(t *testing.T) {
  293. req := v1.TemplateListRequest{}
  294. reply, err := client.TemplateList(context.Background(), &req)
  295. if err != nil {
  296. t.Fatal(err)
  297. } else {
  298. s, _ := json.MarshalToString(reply)
  299. t.Log(s)
  300. }
  301. }
  302. func TestTemplateDetailList(t *testing.T) {
  303. req := v1.TemplateDetailListRequest{
  304. Page: 3,
  305. }
  306. reply, err := client.TemplateDetailList(context.Background(), &req)
  307. if err != nil {
  308. t.Fatal(err)
  309. } else {
  310. s, _ := json.MarshalToString(reply)
  311. t.Log(s)
  312. }
  313. }
  314. func TestUpdateTemplates(t *testing.T) {
  315. req := v1.UpdateMaintainManualRequest{
  316. Tid: 4,
  317. Name: "12312S",
  318. Id: 0,
  319. ItemId: 1001,
  320. StartMile: 100,
  321. StartDate: 6,
  322. MileCycle: 100,
  323. DateCycle: 6,
  324. }
  325. reply, err := client.UpdateTemplateDetail(context.Background(), &req)
  326. if err != nil {
  327. t.Fatal(err)
  328. } else {
  329. s, _ := json.MarshalToString(reply)
  330. t.Log(s)
  331. }
  332. }
  333. func TestChooseTemplateDetail(t *testing.T) {
  334. req := v1.ChooseTemplateDetailRequest{
  335. StyleId: "A090050005",
  336. Tid: 6,
  337. }
  338. reply, err := client.ChooseTemplateDetail(context.Background(), &req)
  339. if err != nil {
  340. t.Fatal(err)
  341. } else {
  342. s, _ := json.MarshalToString(reply)
  343. t.Log(s)
  344. }
  345. }
  346. func TestTemplateItemList(t *testing.T) {
  347. req := v1.TemplateItemListRequest{
  348. ItemType: 1,
  349. Tid: 10,
  350. }
  351. reply, err := client.TemplateItemList(context.Background(), &req)
  352. if err != nil {
  353. t.Fatal(err)
  354. } else {
  355. s, _ := json.MarshalToString(reply)
  356. t.Log(s)
  357. }
  358. }