testrail-ruby 0.0.30 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/endpoints.rb +69 -65
- data/lib/testrail-ruby.rb +1 -0
- data/lib/utility.rb +4 -0
- data/lib/version.rb +1 -1
- data/spec/testrail/endpoints_spec.rb +62 -44
- metadata +2 -2
- data/lib/testrail-ruby-broken.rb +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7387cf9917e3b69f6a5547bce30d099443778c0
|
4
|
+
data.tar.gz: 688ed741faa8d4ccb30132169cc0e503bbe7ac77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cebd0c92601e9ca7816f6796c25bbd422b858fd855dfb28b6fbc47c87a197ccfb1119678851f58b3b0c8a528e9bcd17dda4737ad1a84c0ac7b7febd07730757
|
7
|
+
data.tar.gz: 0b9005153e3c8d851aa2a55b645c38d7a54bb3509d7e46edf5cbdbcd0fcb7386ce33cde1b1a85d25cad45689163beac1dfbe9e6bd8591a6c35be91d06320b2a5
|
data/lib/endpoints.rb
CHANGED
@@ -73,7 +73,7 @@ module Endpoints
|
|
73
73
|
# ]
|
74
74
|
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
75
75
|
def get_cases(project_id, opts = {})
|
76
|
-
options = opts
|
76
|
+
options = param_stringify(opts)
|
77
77
|
send_get("get_cases/#{project_id.to_s}&#{options}")
|
78
78
|
end
|
79
79
|
|
@@ -111,11 +111,11 @@ module Endpoints
|
|
111
111
|
# index.php?/api/v2/update_case/:case_id
|
112
112
|
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
113
113
|
def update_case(case_id, opts = {})
|
114
|
-
send_post("update_case
|
114
|
+
send_post("update_case/#{case_id.to_s}", opts)
|
115
115
|
end
|
116
116
|
|
117
117
|
############################
|
118
|
-
####delete_case
|
118
|
+
####delete_case#############
|
119
119
|
############################
|
120
120
|
# Delete test case by case id
|
121
121
|
# @param case_id [int] The id of the test case
|
@@ -124,10 +124,10 @@ module Endpoints
|
|
124
124
|
# index.php?/api/v2/delete_case/:case_id
|
125
125
|
# @see http://docs.gurock.com/testrail-api2/reference-cases
|
126
126
|
def delete_case(case_id, opts = {})
|
127
|
-
send_post("delete_case
|
127
|
+
send_post("delete_case/#{case_id.to_s}", opts)
|
128
128
|
end
|
129
129
|
|
130
|
-
|
130
|
+
##########################++
|
131
131
|
####get_suite###############
|
132
132
|
############################
|
133
133
|
# Return suite by suite id
|
@@ -136,11 +136,11 @@ module Endpoints
|
|
136
136
|
# @example Endpoint Example
|
137
137
|
# index.php?/api/v2/get_suite/:suite_id
|
138
138
|
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
139
|
-
def get_suite(suite_id
|
140
|
-
send_get("get_suite
|
139
|
+
def get_suite(suite_id)
|
140
|
+
send_get("get_suite/#{suite_id.to_s}")
|
141
141
|
end
|
142
142
|
|
143
|
-
|
143
|
+
##########################++
|
144
144
|
####get_suites##############
|
145
145
|
############################
|
146
146
|
# Return all suites in project by project id
|
@@ -149,8 +149,8 @@ module Endpoints
|
|
149
149
|
# @example Endpoint Example
|
150
150
|
# index.php?/api/v2/get_suites/:project_id
|
151
151
|
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
152
|
-
def get_suites(project_id
|
153
|
-
send_get("get_suites
|
152
|
+
def get_suites(project_id)
|
153
|
+
send_get("get_suites/#{project_id.to_s}")
|
154
154
|
end
|
155
155
|
|
156
156
|
############################
|
@@ -163,7 +163,7 @@ module Endpoints
|
|
163
163
|
# index.php?/api/v2/add_suite/:project_id
|
164
164
|
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
165
165
|
def add_suite(project_id, opts = {})
|
166
|
-
send_post("add_suite
|
166
|
+
send_post("add_suite/#{project_id.to_s}", opts)
|
167
167
|
end
|
168
168
|
|
169
169
|
############################
|
@@ -176,7 +176,7 @@ module Endpoints
|
|
176
176
|
# index.php?/api/v2/update_suite/:suite_id
|
177
177
|
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
178
178
|
def update_suite(suite_id, opts = {})
|
179
|
-
send_post("update_suite
|
179
|
+
send_post("update_suite/#{suite_id.to_s}", opts)
|
180
180
|
end
|
181
181
|
|
182
182
|
############################
|
@@ -189,11 +189,11 @@ module Endpoints
|
|
189
189
|
# index.php?/api/v2/delete_suite/:suite_id
|
190
190
|
# @see http://docs.gurock.com/testrail-api2/reference-suites
|
191
191
|
def delete_suite(suite_id, opts = {})
|
192
|
-
send_post("delete_suite
|
192
|
+
send_post("delete_suite/#{suite_id.to_s}", opts)
|
193
193
|
end
|
194
194
|
|
195
195
|
|
196
|
-
|
196
|
+
##########################++
|
197
197
|
####get_section#############
|
198
198
|
############################
|
199
199
|
# Return section by id
|
@@ -202,8 +202,8 @@ module Endpoints
|
|
202
202
|
# @example Endpoint Example
|
203
203
|
# index.php?/api/v2/get_section/:section_id
|
204
204
|
# @see http://docs.gurock.com/testrail-api2/reference-sections
|
205
|
-
def get_section(section_id
|
206
|
-
send_get("get_section
|
205
|
+
def get_section(section_id)
|
206
|
+
send_get("get_section/#{section_id.to_s}")
|
207
207
|
end
|
208
208
|
|
209
209
|
##########################++
|
@@ -219,7 +219,7 @@ module Endpoints
|
|
219
219
|
# client.get_sections(1, {"suite_id":2})
|
220
220
|
# @see http://docs.gurock.com/testrail-api2/reference-sections
|
221
221
|
def get_sections(project_id, opts = {})
|
222
|
-
options = opts
|
222
|
+
options = param_stringify(opts)
|
223
223
|
send_get("get_sections/#{project_id.to_s}&#{options}")
|
224
224
|
end
|
225
225
|
|
@@ -251,7 +251,7 @@ module Endpoints
|
|
251
251
|
# index.php?/api/v2/get_milestone/:milestone_id
|
252
252
|
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
253
253
|
def get_milestone(milestone_id, opts = {})
|
254
|
-
send_get("get_milestone
|
254
|
+
send_get("get_milestone/#{milestone_id.to_s}", opts)
|
255
255
|
end
|
256
256
|
|
257
257
|
############################
|
@@ -264,7 +264,7 @@ module Endpoints
|
|
264
264
|
# index.php?/api/v2/get_milestones/:project_id
|
265
265
|
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
266
266
|
def get_milestones(project_id, opts = {})
|
267
|
-
send_get("get_milestones
|
267
|
+
send_get("get_milestones/#{project_id.to_s}", opts)
|
268
268
|
end
|
269
269
|
|
270
270
|
############################
|
@@ -277,7 +277,7 @@ module Endpoints
|
|
277
277
|
# index.php?/api/v2/add_milestone/:project_id
|
278
278
|
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
279
279
|
def add_milestone(project_id, opts = {})
|
280
|
-
send_post("add_milestone
|
280
|
+
send_post("add_milestone/#{project_id.to_s}", opts)
|
281
281
|
end
|
282
282
|
|
283
283
|
############################
|
@@ -290,7 +290,7 @@ module Endpoints
|
|
290
290
|
# index.php?/api/v2/update_milestone/:milestone_id
|
291
291
|
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
292
292
|
def update_milestone(milestone_id, opts = {})
|
293
|
-
send_post("update_milestone
|
293
|
+
send_post("update_milestone/#{milestone_id.to_s}", opts)
|
294
294
|
end
|
295
295
|
|
296
296
|
############################
|
@@ -303,10 +303,10 @@ module Endpoints
|
|
303
303
|
# index.php?/api/v2/delete_milestone/:milestone_id
|
304
304
|
# @see http://docs.gurock.com/testrail-api2/reference-milestones
|
305
305
|
def delete_milestone(milestone_id, opts = {})
|
306
|
-
send_post("delete_milestone
|
306
|
+
send_post("delete_milestone/#{milestone_id.to_s}", opts)
|
307
307
|
end
|
308
308
|
|
309
|
-
|
309
|
+
##########################++
|
310
310
|
####get_plan################
|
311
311
|
############################
|
312
312
|
# Get plan by id
|
@@ -315,11 +315,11 @@ module Endpoints
|
|
315
315
|
# @example Endpoint Example
|
316
316
|
# index.php?/api/v2/get_plan/:plan_id
|
317
317
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
318
|
-
def get_plan(plan_id
|
319
|
-
send_get("get_plan
|
318
|
+
def get_plan(plan_id)
|
319
|
+
send_get("get_plan/#{plan_id.to_s}")
|
320
320
|
end
|
321
321
|
|
322
|
-
|
322
|
+
##########################++
|
323
323
|
####get_plans###############
|
324
324
|
############################
|
325
325
|
# Get plans in project by project id
|
@@ -328,8 +328,8 @@ module Endpoints
|
|
328
328
|
# @example Endpoint Example
|
329
329
|
# index.php?/api/v2/get_plans/:project_id
|
330
330
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
331
|
-
def get_plans(project_id
|
332
|
-
send_get("get_plans
|
331
|
+
def get_plans(project_id)
|
332
|
+
send_get("get_plans/#{project_id.to_s}")
|
333
333
|
end
|
334
334
|
|
335
335
|
############################
|
@@ -342,7 +342,7 @@ module Endpoints
|
|
342
342
|
# index.php?/api/v2/add_plan/:project_id
|
343
343
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
344
344
|
def add_plan(project_id, opts = {})
|
345
|
-
send_post("add_plan
|
345
|
+
send_post("add_plan/#{project_id.to_s}", opts)
|
346
346
|
end
|
347
347
|
|
348
348
|
############################
|
@@ -355,7 +355,7 @@ module Endpoints
|
|
355
355
|
# index.php?/api/v2/add_plan_entry/:plan_id
|
356
356
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
357
357
|
def add_plan_entry(plan_id, opts = {})
|
358
|
-
send_post("add_plan_entry
|
358
|
+
send_post("add_plan_entry/#{plan_id.to_s}", opts)
|
359
359
|
end
|
360
360
|
|
361
361
|
############################
|
@@ -368,7 +368,7 @@ module Endpoints
|
|
368
368
|
# index.php?/api/v2/update_plan/:plan_id
|
369
369
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
370
370
|
def update_plan(plan_id, opts = {})
|
371
|
-
send_post("update_plan
|
371
|
+
send_post("update_plan/#{plan_id.to_s}", opts)
|
372
372
|
end
|
373
373
|
|
374
374
|
############################
|
@@ -382,7 +382,7 @@ module Endpoints
|
|
382
382
|
# index.php?/api/v2/update_plan_entry/:plan_id/:entry_id
|
383
383
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
384
384
|
def update_plan_entry(plan_id, entry_id, opts = {})
|
385
|
-
send_post("update_plan_entry
|
385
|
+
send_post("update_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
|
386
386
|
end
|
387
387
|
|
388
388
|
############################
|
@@ -395,7 +395,7 @@ module Endpoints
|
|
395
395
|
# index.php?/api/v2/close_plan/:plan_id
|
396
396
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
397
397
|
def close_plan(plan_id, opts = {})
|
398
|
-
send_post("close_plan
|
398
|
+
send_post("close_plan/#{plan_id.to_s}", opts)
|
399
399
|
end
|
400
400
|
|
401
401
|
############################
|
@@ -405,7 +405,7 @@ module Endpoints
|
|
405
405
|
# index.php?/api/v2/delete_plan/:plan_id
|
406
406
|
# @see http://docs.gurock.com/testrail-api2/reference-plans
|
407
407
|
def delete_plan(plan_id, opts)
|
408
|
-
send_post("delete_plan
|
408
|
+
send_post("delete_plan/#{plan_id.to_s}", opts)
|
409
409
|
end
|
410
410
|
|
411
411
|
############################
|
@@ -414,10 +414,10 @@ module Endpoints
|
|
414
414
|
# @example Endpoint Example
|
415
415
|
# index.php?/api/v2/delete_plan_entry/:plan_id/:entry_id
|
416
416
|
def delete_plan_entry(plan_id, entry_id, opts = {})
|
417
|
-
send_post("delete_plan_entry
|
417
|
+
send_post("delete_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
|
418
418
|
end
|
419
419
|
|
420
|
-
|
420
|
+
##########################++
|
421
421
|
####get_project#############
|
422
422
|
############################
|
423
423
|
# Get project by project id
|
@@ -427,7 +427,7 @@ module Endpoints
|
|
427
427
|
# index.php?/api/v2/get_project/:project_id
|
428
428
|
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
429
429
|
def get_project(project_id, opts = {})
|
430
|
-
options = opts
|
430
|
+
options = param_stringify(opts)
|
431
431
|
send_get("get_project/#{project_id.to_s}&#{options}")
|
432
432
|
end
|
433
433
|
|
@@ -453,7 +453,7 @@ module Endpoints
|
|
453
453
|
# ]
|
454
454
|
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
455
455
|
def get_projects(opts = {})
|
456
|
-
options = opts
|
456
|
+
options = param_stringify(opts)
|
457
457
|
send_get("get_projects&#{options}")
|
458
458
|
end
|
459
459
|
|
@@ -479,7 +479,7 @@ module Endpoints
|
|
479
479
|
# index.php?/api/v2/update_project/:project_id
|
480
480
|
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
481
481
|
def update_project(project_id, opts)
|
482
|
-
send_post("update_project
|
482
|
+
send_post("update_project/#{project_id.to_s}", opts)
|
483
483
|
end
|
484
484
|
|
485
485
|
############################
|
@@ -492,10 +492,10 @@ module Endpoints
|
|
492
492
|
# index.php?/api/v2/delete_project/:project_id
|
493
493
|
# @see http://docs.gurock.com/testrail-api2/reference-projects
|
494
494
|
def delete_project(project_id, opts)
|
495
|
-
send_post("delete_project
|
495
|
+
send_post("delete_project/#{project_id.to_s}", opts)
|
496
496
|
end
|
497
497
|
|
498
|
-
|
498
|
+
##########################==
|
499
499
|
####get_results#############
|
500
500
|
############################
|
501
501
|
# Returns a list of test results for a test
|
@@ -505,10 +505,11 @@ module Endpoints
|
|
505
505
|
# index.php?/api/v2/get_results/:test_id
|
506
506
|
# @see http://docs.gurock.com/testrail-api2/reference-results
|
507
507
|
def get_results(test_id, opts = {})
|
508
|
-
|
508
|
+
options = param_stringify(opts)
|
509
|
+
send_get("get_results/#{test_id.to_s}&#{options}")
|
509
510
|
end
|
510
511
|
|
511
|
-
|
512
|
+
##########################==
|
512
513
|
####get_results_for_case####
|
513
514
|
############################
|
514
515
|
# Returns a list of test results for a test run and case combination
|
@@ -519,10 +520,11 @@ module Endpoints
|
|
519
520
|
# index.php?/api/v2/get_results_for_case/:run_id/:case_id
|
520
521
|
# @see http://docs.gurock.com/testrail-api2/reference-results
|
521
522
|
def get_results_for_case(run_id, case_id, opts = {})
|
522
|
-
|
523
|
+
options = param_stringify(opts)
|
524
|
+
send_get("get_results_for_case/#{run_id.to_s}/#{case_id.to_s}&#{options}")
|
523
525
|
end
|
524
526
|
|
525
|
-
|
527
|
+
##########################==
|
526
528
|
####get_results_for_run#####
|
527
529
|
############################
|
528
530
|
# Returns a list of test results for a test run
|
@@ -532,7 +534,8 @@ module Endpoints
|
|
532
534
|
# index.php?/api/v2/get_results_for_run/:run_id
|
533
535
|
# @see http://docs.gurock.com/testrail-api2/reference-results
|
534
536
|
def get_results_for_run(run_id, opts = {})
|
535
|
-
|
537
|
+
options = param_stringify(opts)
|
538
|
+
send_get("get_results_for_run/#{run_id.to_s}&#{options}")
|
536
539
|
end
|
537
540
|
|
538
541
|
############################
|
@@ -545,7 +548,7 @@ module Endpoints
|
|
545
548
|
# index.php?/api/v2/add_result/:test_id
|
546
549
|
# @see http://docs.gurock.com/testrail-api2/reference-results
|
547
550
|
def add_result(test_id, opts = {})
|
548
|
-
send_post("add_result
|
551
|
+
send_post("add_result/#{test_id.to_s}", opts)
|
549
552
|
end
|
550
553
|
|
551
554
|
############################
|
@@ -559,7 +562,7 @@ module Endpoints
|
|
559
562
|
# index.php?/api/v2/add_result_for_case/:run_id/:case_id
|
560
563
|
# @see http://docs.gurock.com/testrail-api2/reference-results
|
561
564
|
def add_result_for_case(run_id, case_id, opts = {})
|
562
|
-
send_post("add_result_for_case
|
565
|
+
send_post("add_result_for_case/#{run_id.to_s}/#{case_id.to_s}", opts)
|
563
566
|
end
|
564
567
|
|
565
568
|
############################
|
@@ -572,7 +575,7 @@ module Endpoints
|
|
572
575
|
# index.php?/api/v2/add_results/:run_id
|
573
576
|
# @see http://docs.gurock.com/testrail-api2/reference-results
|
574
577
|
def add_results(run_id, opts = {})
|
575
|
-
send_post("add_results
|
578
|
+
send_post("add_results/#{run_id.to_s}", opts)
|
576
579
|
end
|
577
580
|
|
578
581
|
############################
|
@@ -585,10 +588,10 @@ module Endpoints
|
|
585
588
|
# index.php?/api/v2/add_results_for_cases/:run_id
|
586
589
|
# @see http://docs.gurock.com/testrail-api2/reference-results
|
587
590
|
def add_results_for_cases(run_id, opts = {})
|
588
|
-
send_post("add_results_for_cases
|
591
|
+
send_post("add_results_for_cases/#{run_id.to_s}", opts)
|
589
592
|
end
|
590
593
|
|
591
|
-
|
594
|
+
##########################==
|
592
595
|
####get_run#################
|
593
596
|
############################
|
594
597
|
# Get run by run id
|
@@ -597,11 +600,11 @@ module Endpoints
|
|
597
600
|
# @example Endpoint Example
|
598
601
|
# index.php?/api/v2/get_run/:run_id
|
599
602
|
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
600
|
-
def get_run(run_id
|
601
|
-
send_get("get_run
|
603
|
+
def get_run(run_id)
|
604
|
+
send_get("get_run/#{run_id.to_s}")
|
602
605
|
end
|
603
606
|
|
604
|
-
|
607
|
+
##########################==
|
605
608
|
####get_runs################
|
606
609
|
############################
|
607
610
|
# Get runs by project id
|
@@ -612,7 +615,8 @@ module Endpoints
|
|
612
615
|
# index.php?/api/v2/get_runs/:project_id
|
613
616
|
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
614
617
|
def get_runs(project_id, opts = {})
|
615
|
-
|
618
|
+
options = param_stringify(opts)
|
619
|
+
send_get("get_runs/#{project_id.to_s}&#{options}")
|
616
620
|
end
|
617
621
|
|
618
622
|
############################
|
@@ -625,7 +629,7 @@ module Endpoints
|
|
625
629
|
# index.php?/api/v2/add_run/:project_id
|
626
630
|
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
627
631
|
def add_run(project_id, opts = {})
|
628
|
-
send_post("add_run
|
632
|
+
send_post("add_run/#{project_id.to_s}", opts)
|
629
633
|
end
|
630
634
|
|
631
635
|
############################
|
@@ -638,7 +642,7 @@ module Endpoints
|
|
638
642
|
# index.php?/api/v2/update_run/:run_id
|
639
643
|
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
640
644
|
def update_run(run_id, opts = {})
|
641
|
-
send_post("update_run
|
645
|
+
send_post("update_run/#{run_id.to_s}", opts)
|
642
646
|
end
|
643
647
|
|
644
648
|
############################
|
@@ -664,23 +668,22 @@ module Endpoints
|
|
664
668
|
# index.php?/api/v2/delete_run/:run_id
|
665
669
|
# @see http://docs.gurock.com/testrail-api2/reference-runs
|
666
670
|
def delete_run(run_id, opts = {})
|
667
|
-
send_post("delete_run
|
671
|
+
send_post("delete_run/#{run_id.to_s}", opts)
|
668
672
|
end
|
669
673
|
|
670
|
-
|
674
|
+
##########################==
|
671
675
|
####get_test################
|
672
676
|
############################
|
673
677
|
# Returns an existing test
|
674
678
|
# @param test_id [int]
|
675
|
-
# @param [Hash] opts
|
676
679
|
# @example Endpoint Example
|
677
680
|
# index.php?/api/v2/get_test/:test_id
|
678
681
|
# @see http://docs.gurock.com/testrail-api2/reference-tests
|
679
|
-
def get_test(test_id
|
680
|
-
send_get("get_test
|
682
|
+
def get_test(test_id)
|
683
|
+
send_get("get_test/#{test_id.to_s}")
|
681
684
|
end
|
682
685
|
|
683
|
-
|
686
|
+
##########################==
|
684
687
|
####get_tests###############
|
685
688
|
############################
|
686
689
|
# Returns a list of tests for a test run
|
@@ -690,7 +693,8 @@ module Endpoints
|
|
690
693
|
# index.php?/api/v2/get_tests/:run_id
|
691
694
|
# @see http://docs.gurock.com/testrail-api2/reference-tests
|
692
695
|
def get_tests(run_id, opts = {})
|
693
|
-
|
696
|
+
options = param_stringify(opts)
|
697
|
+
send_get("get_tests/#{run_id.to_s}&#{options}")
|
694
698
|
end
|
695
699
|
|
696
|
-
end
|
700
|
+
end #close module
|
data/lib/testrail-ruby.rb
CHANGED
data/lib/utility.rb
ADDED
data/lib/version.rb
CHANGED
@@ -19,65 +19,83 @@ RSpec.describe "get_case" do
|
|
19
19
|
puts "Response:\n#{response}"
|
20
20
|
expect(response).not_to be_empty
|
21
21
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
expect(response).to include("section_id")
|
30
|
-
end
|
31
|
-
it 'returns a template_id' do
|
32
|
-
expect(response).to include("template_id")
|
33
|
-
end
|
34
|
-
it 'returns a type_id' do
|
35
|
-
expect(response).to include("type_id")
|
36
|
-
end
|
37
|
-
it 'returns a priority_id' do
|
38
|
-
expect(response).to include("priority_id")
|
39
|
-
end
|
40
|
-
it 'returns a milestone_id' do
|
41
|
-
expect(response).to include("milestone_id")
|
42
|
-
end
|
43
|
-
it 'returns a refs' do
|
44
|
-
expect(response).to include("refs")
|
45
|
-
end
|
46
|
-
it 'returns a created_by' do
|
47
|
-
expect(response).to include("created_by")
|
48
|
-
end
|
49
|
-
it 'returns a created_on' do
|
50
|
-
expect(response).to include("created_on")
|
22
|
+
end #describe
|
23
|
+
|
24
|
+
RSpec.describe "get_cases" do
|
25
|
+
response = client.get_cases(1, {"suite_id":1, "section_id":1})
|
26
|
+
it 'is not empty' do
|
27
|
+
puts "Response:\n#{response}"
|
28
|
+
expect(response).not_to be_empty
|
51
29
|
end
|
52
|
-
|
53
|
-
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec.describe "add_case" do
|
33
|
+
response = client.add_case(1, {"title":"testCaseName", "type_id":1})
|
34
|
+
it 'is not empty' do
|
35
|
+
puts "Response:\n#{response}"
|
36
|
+
expect(response).not_to be_empty
|
54
37
|
end
|
55
|
-
|
56
|
-
|
38
|
+
end
|
39
|
+
|
40
|
+
RSpec.describe "get_section" do
|
41
|
+
response = client.get_section(1)
|
42
|
+
it 'is not empty' do
|
43
|
+
puts "Response:\n#{response}"
|
44
|
+
expect(response).not_to be_empty
|
57
45
|
end
|
58
|
-
|
59
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
RSpec.describe "get_sections" do
|
49
|
+
response = client.get_sections(1, {"suite_id":1, "section_id":1})
|
50
|
+
it 'is not empty' do
|
51
|
+
puts "Response:\n#{response}"
|
52
|
+
expect(response).not_to be_empty
|
60
53
|
end
|
61
|
-
|
62
|
-
|
54
|
+
end
|
55
|
+
|
56
|
+
RSpec.describe "get_suite" do
|
57
|
+
response = client.get_suite(1)
|
58
|
+
it 'is not empty' do
|
59
|
+
puts "Response:\n#{response}"
|
60
|
+
expect(response).not_to be_empty
|
63
61
|
end
|
64
|
-
|
65
|
-
|
62
|
+
end
|
63
|
+
|
64
|
+
RSpec.describe "get_suites" do
|
65
|
+
response = client.get_suites(1)
|
66
|
+
it 'is not empty' do
|
67
|
+
puts "Response:\n#{response}"
|
68
|
+
expect(response).not_to be_empty
|
66
69
|
end
|
67
|
-
end
|
70
|
+
end
|
68
71
|
|
69
|
-
RSpec.describe "
|
70
|
-
response = client.
|
72
|
+
RSpec.describe "get_plan" do
|
73
|
+
response = client.get_plan(21)
|
71
74
|
it 'is not empty' do
|
72
75
|
puts "Response:\n#{response}"
|
73
76
|
expect(response).not_to be_empty
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
77
|
-
RSpec.describe "
|
78
|
-
response = client.
|
80
|
+
RSpec.describe "get_project" do
|
81
|
+
response = client.get_project(1)
|
79
82
|
it 'is not empty' do
|
80
83
|
puts "Response:\n#{response}"
|
81
84
|
expect(response).not_to be_empty
|
82
85
|
end
|
83
86
|
end
|
87
|
+
|
88
|
+
RSpec.describe "get_projects" do
|
89
|
+
|
90
|
+
# it 'is_complete 1 (true) is not empty' do
|
91
|
+
# response = client.get_projects({"is_completed":1})
|
92
|
+
# puts "Response:\n#{response}"
|
93
|
+
# expect(response).not_to be_empty
|
94
|
+
# end
|
95
|
+
|
96
|
+
it 'is_complete(false) is not empty' do
|
97
|
+
response = client.get_projects({"is_completed":0})
|
98
|
+
puts "Response:\n#{response}"
|
99
|
+
expect(response).not_to be_empty
|
100
|
+
end
|
101
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testrail-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frances Morales
|
@@ -175,8 +175,8 @@ files:
|
|
175
175
|
- README.md
|
176
176
|
- Rakefile
|
177
177
|
- lib/endpoints.rb
|
178
|
-
- lib/testrail-ruby-broken.rb
|
179
178
|
- lib/testrail-ruby.rb
|
179
|
+
- lib/utility.rb
|
180
180
|
- lib/version.rb
|
181
181
|
- spec/spec_helper.rb
|
182
182
|
- spec/testrail/endpoints_spec.rb
|
data/lib/testrail-ruby-broken.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
require_relative 'version'
|
2
|
-
require_relative 'endpoints'
|
3
|
-
require 'net/http'
|
4
|
-
require 'net/https'
|
5
|
-
require 'uri'
|
6
|
-
require 'json'
|
7
|
-
|
8
|
-
## #USAGE:
|
9
|
-
## #@client = TestRail::APIClient.new('YourBaseURLHere')
|
10
|
-
## #@client.user = 'UserName'
|
11
|
-
## #@client.password = 'Password'
|
12
|
-
|
13
|
-
module TestRail
|
14
|
-
class APIClient
|
15
|
-
@url = ''
|
16
|
-
@user = ''
|
17
|
-
@password = ''
|
18
|
-
|
19
|
-
include Endpoints
|
20
|
-
attr_accessor :user
|
21
|
-
attr_accessor :password
|
22
|
-
|
23
|
-
def initialize(base_url)
|
24
|
-
base_url += '/' unless base_url =~ /\/$/
|
25
|
-
@url = base_url + 'index.php?/api/v2/'
|
26
|
-
end
|
27
|
-
|
28
|
-
def send_get(uri, data)
|
29
|
-
puts "Getting: #{uri}"
|
30
|
-
puts "Sending Data: #{data}"
|
31
|
-
_send_request('GET', uri, data)
|
32
|
-
end
|
33
|
-
|
34
|
-
def send_post(uri, data)
|
35
|
-
puts "Posting: #{uri}"
|
36
|
-
puts "Sending Data: #{data}"
|
37
|
-
_send_request('POST', uri, data)
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def _send_request(method, uri, data)
|
43
|
-
url = URI.parse(@url + uri)
|
44
|
-
puts "URL: #{url}"
|
45
|
-
puts "url.query: #{url.query}"
|
46
|
-
puts "Data Payload: #{data}"
|
47
|
-
if method == 'POST'
|
48
|
-
request = Net::HTTP::Post.new(url.path + '?' + url.query)
|
49
|
-
request.body = JSON.dump(data)
|
50
|
-
else
|
51
|
-
request = Net::HTTP::Get.new(url.path + '?' + url.query)
|
52
|
-
end
|
53
|
-
request.basic_auth(@user, @password)
|
54
|
-
request.add_field('Content-Type', 'application/json')
|
55
|
-
|
56
|
-
conn = Net::HTTP.new(url.host, url.port)
|
57
|
-
if url.scheme == 'https'
|
58
|
-
conn.use_ssl = true
|
59
|
-
conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
60
|
-
end
|
61
|
-
response = conn.request(request)
|
62
|
-
|
63
|
-
result = if response.body && !response.body.empty?
|
64
|
-
JSON.parse(response.body)
|
65
|
-
else
|
66
|
-
{}
|
67
|
-
end
|
68
|
-
|
69
|
-
if response.code != '200'
|
70
|
-
error = if result && result.key?('error')
|
71
|
-
'"' + result['error'] + '"'
|
72
|
-
else
|
73
|
-
'No additional error message received'
|
74
|
-
end
|
75
|
-
raise APIError, 'TestRail API returned HTTP %s (%s)' %
|
76
|
-
[response.code, error]
|
77
|
-
end
|
78
|
-
|
79
|
-
result
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
class APIError < StandardError
|
84
|
-
end
|
85
|
-
end
|