Produced by Araxis Merge on 10/4/2017 8:04:43 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | rdk.zip\rdk\product\tests\rspec-tests\lib\helper | HTTPartyWithBasicAuth.rb | Mon Aug 21 12:51:01 2017 UTC |
| 2 | rdk.zip\rdk\product\tests\rspec-tests\lib\helper | HTTPartyWithBasicAuth.rb | Wed Oct 4 12:31:53 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 316 |
| Changed | 2 | 20 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | require "h ttparty" | |
| 2 | ||
| 3 | path = Fil e.expand_p ath '..', __FILE__ | |
| 4 | $LOAD_PATH .unshift p ath unless $LOAD_PAT H.include? (path) | |
| 5 | require "D efaultLogi n.rb" | |
| 6 | require "T estSupport .rb" | |
| 7 | require "D omAccess.r b" | |
| 8 | require "P atientPick erDomEleme nts.rb" | |
| 9 | ||
| 10 | class Test Clients | |
| 11 | @@users = {} | |
| 12 | ||
| 13 | @@users[" R E D A CTED "] = " REDACTED " | |
| 14 | @@users[" REDA C TED "] = " REDACTED " | |
| 15 | @@users["U nauthorize dUser"] = " REDACTED " | |
| 16 | @@users["A uditLogUse r"] = " REDACTED " | |
| 17 | @@users[" R E D A CTED "] = " REDACTED " | |
| 18 | @@users[" R E D A CTED "] = " REDACTED " | |
| 19 | @@users[" R E D A CTED "] = " REDACTED " | |
| 20 | @@users[" R E D A CTED "] = " REDACTED " | |
| 21 | ||
| 22 | def self .password_ for(userna me) | |
| 23 | return @@users[u sername] | |
| 24 | end | |
| 25 | end | |
| 26 | ||
| 27 | class HTTP artyWithBa sicAuth | |
| 28 | include HTTParty | |
| 29 | #@@auth = { :usernam e => " PR E D A CTED ", :passwo rd => " REDACTED " } | |
| 30 | @@auth = { :accessCo de => " REDACT ", :verify Code => " REDACTED ", :site = > " R E D A CTED " } | |
| 31 | @@time_s tart = Tim e.new | |
| 32 | @@time_d one = Time .new | |
| 33 | @@time_o ut_time = 300 | |
| 34 | ||
| 35 | def self .auth | |
| 36 | return @@auth | |
| 37 | end | |
| 38 | ||
| 39 | def self .time_elap sed_last_c all | |
| 40 | return @@time_do ne - @@tim e_start | |
| 41 | end | |
| 42 | ||
| 43 | def self .post_with _authoriza tion(path) | |
| 44 | # "Aut horization ", "Basic QjM2Mjs1MD A6cHUxMjM0 O3B1MTIzNC Eh" | |
| 45 | # dire ctory = po st(path, { :verify = > false, : headers => @@header, :basic_a uth => @@a uth }) | |
| 46 | p "POS T " + path | |
| 47 | @@time _start = T ime.new | |
| 48 | direct ory = post (path, { : verify => false, :qu ery => @@a uth, :time out => @@t ime_out_ti me }) | |
| 49 | @@time _done = Ti me.new | |
| 50 | log_id = directo ry.headers ['logid'] | |
| 51 | p "log Id: #{log_ id}" if lo g_id | |
| 52 | return directory | |
| 53 | end | |
| 54 | ||
| 55 | def self .get_with_ authorizat ion(path, time_out = @@time_ou t_time) | |
| 56 | p path | |
| 57 | direct ory = nil | |
| 58 | begin | |
| 59 | ||
| 60 | @@ti me_start = Time.new | |
| 61 | begi n | |
| 62 | di rectory = get(path, { :verify => false, :query => @@auth, :t imeout => time_out } ) | |
| 63 | resc ue Excepti on => e | |
| 64 | p "Exception : #{e}" | |
| 65 | end | |
| 66 | @@ti me_done = Time.new | |
| 67 | log_ id = direc tory.heade rs['logid' ] | |
| 68 | p "l ogId: #{lo g_id}" if log_id | |
| 69 | rescue Exception => e | |
| 70 | @@ti me_done = Time.new | |
| 71 | p "T ime to fai lure: #{ti me_elapsed _last_call }" | |
| 72 | rais e e, "Time to failur e: #{time_ elapsed_la st_call}" | |
| 73 | end | |
| 74 | return directory | |
| 75 | end | |
| 76 | ||
| 77 | def self .get_with_ authorizat ion_for_us er(path, u ser, pass) | |
| 78 | p "GET " + path | |
| 79 | p "Aut h user: " + user | |
| 80 | access = user.sp lit(';')[1 ] | |
| 81 | site = user.spli t(';')[0] | |
| 82 | @@time _start = T ime.new | |
| 83 | auth = { :access Code => ac cess, :ver ifyCode => pass, :si te => site } | |
| 84 | direct ory = get( path, { :v erify => f alse, :que ry => auth , :timeout => @@time _out_time }) | |
| 85 | @@time _done = Ti me.new | |
| 86 | log_id = directo ry.headers ['logid'] | |
| 87 | p "log Id: #{log_ id}" if lo g_id | |
| 88 | return directory | |
| 89 | end | |
| 90 | ||
| 91 | def self .put_with_ authorizat ion(path) | |
| 92 | p "PUT " + path | |
| 93 | @@time _start = T ime.new | |
| 94 | direct ory = put( path, { :v erify => f alse, :que ry => @@au th, :timeo ut => @@ti me_out_tim e }) | |
| 95 | @@time _done = Ti me.new | |
| 96 | log_id = directo ry.headers ['logid'] | |
| 97 | p "log Id: #{log_ id}" if lo g_id | |
| 98 | return directory | |
| 99 | end | |
| 100 | ||
| 101 | def self .post_json _with_auth orization( path, json , headers = {}) | |
| 102 | p path | |
| 103 | option s = {} | |
| 104 | option s[:verify] = false | |
| 105 | option s[:query] = @@auth | |
| 106 | option s[:timeout ] = @@time _out_time | |
| 107 | option s[:body] = json | |
| 108 | option s[:headers ] = header s unless h eaders.emp ty? | |
| 109 | direct ory = post (path, opt ions) | |
| 110 | log_id = directo ry.headers ['logid'] | |
| 111 | p "log Id: #{log_ id}" if lo g_id | |
| 112 | return directory | |
| 113 | end | |
| 114 | ||
| 115 | def self .put_json_ with_autho rization(p ath, json, headers = {}) | |
| 116 | p "PUT " + path | |
| 117 | option s = {} | |
| 118 | option s[:verify] = false | |
| 119 | option s[:query] = @@auth | |
| 120 | option s[:timeout ] = @@time _out_time | |
| 121 | option s[:body] = json | |
| 122 | option s[:headers ] = header s unless h eaders.emp ty? | |
| 123 | direct ory = put( path, opti ons) | |
| 124 | log_id = directo ry.headers ['logid'] | |
| 125 | p "log Id: #{log_ id}" if lo g_id | |
| 126 | return directory | |
| 127 | end | |
| 128 | ||
| 129 | def self .delete_wi th_authori zation(pat h) | |
| 130 | p "DEL ETE " + pa th | |
| 131 | @@time _start = T ime.new | |
| 132 | #direc tory = del ete(path, { :verify => false, :basic_aut h => @@aut h, :timeo ut => @@ti me_out_tim e, :body = > json }) | |
| 133 | # dire ctory = de lete(path, { :verify => false, :query => @@auth, :timeout = > @@time_o ut_time, : body => js on }) | |
| 134 | direct ory = dele te(path, { :verify = > false, : query => @ @auth, :t imeout => @@time_out _time }) | |
| 135 | @@time _done = Ti me.new | |
| 136 | log_id = directo ry.headers ['logid'] | |
| 137 | p "log Id: #{log_ id}" if lo g_id | |
| 138 | return directory | |
| 139 | end | |
| 140 | ||
| 141 | def self .get_json_ with_autho rization(p ath, json, headers = {}) | |
| 142 | p path | |
| 143 | option s = {} | |
| 144 | option s[:verify] = false | |
| 145 | option s[:query] = @@auth | |
| 146 | option s[:timeout ] = @@time _out_time | |
| 147 | option s[:body] = json | |
| 148 | option s[:headers ] = header s unless h eaders.emp ty? | |
| 149 | direct ory = get( path, opti ons) | |
| 150 | log_id = directo ry.headers ['logid'] | |
| 151 | p "log Id: #{log_ id}" if lo g_id | |
| 152 | return directory | |
| 153 | end | |
| 154 | ||
| 155 | def self .delete_js on_with_au thorizatio n(path, js on, header s = {}) | |
| 156 | p path | |
| 157 | option s = {} | |
| 158 | option s[:verify] = false | |
| 159 | option s[:query] = @@auth | |
| 160 | option s[:timeout ] = @@time _out_time | |
| 161 | option s[:body] = json | |
| 162 | option s[:headers ] = header s unless h eaders.emp ty? | |
| 163 | direct ory = dele te(path, o ptions) | |
| 164 | log_id = directo ry.headers ['logid'] | |
| 165 | p "log Id: #{log_ id}" if lo g_id | |
| 166 | return directory | |
| 167 | end | |
| 168 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.