136. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/14/2017 1:28:15 PM Eastern Standard 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.

136.1 Files compared

# Location File Last Modified
1 CUI-CPP-v2.3.2-source.zip\spec\jobs vler_das_job_spec.rb Mon Nov 20 23:19:07 2017 UTC
2 CUI-CPP-v2.3.2-source.zip\spec\jobs vler_das_job_spec.rb Tue Dec 12 20:50:15 2017 UTC

136.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 218
Changed 1 2
Inserted 0 0
Removed 0 0

136.3 Comparison options

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

136.4 Active regular expressions

No regular expressions were active.

136.5 Comparison detail

  1   require 'r ails_helpe r'
  2   require 'm ail'
  3   HTTPI.log  = false
  4  
  5   RSpec.desc ribe VlerD ASJob, :ty pe => :job  do
  6     before d o
  7       allow_ any_instan ce_of(Eval uation).to  receive(: signed?).a nd_return( true)
  8       @evalu ation_spec  = create( :tmj_spec)
  9       @claim  = create( :claim)
  10       @user  = create(: examiner)
  11       @claim .contentio ns << crea te(:conten tion, hist ory: "This  or That")
  12       @evalu ation = Ev aluation.n ew(claim:  @claim,
  13                                       evaluat ion_spec:  @evaluatio n_spec,
  14                                       doc: bu ild(:tmj_e val).doc,
  15                                       complet ed_at: Tim e.now,
  16                                       user: @ user)
  17       @claim .contentio ns.first.e valuations  << @evalu ation
  18       @evalu ation.comp lete! @use r
  19       allow_ any_instan ce_of(Eval uation).to  receive(: to_pdf) {  "" }
  20       ENV['V LER_DAS_UR L'] = "htt p://exampl e.com/api/ v1"
  21     end
  22  
  23     it "does  not creat e a reques t to send  if the eva luation is  not compl ete and lo gs the err or" do
  24       evalua tion_spec  = create(: diabetes_s pec)
  25       claim  = create(: claim)
  26         user = cre ate(:user,  email: " PII          ")
  27       claim. contention s << creat e(:content ion, histo ry: "This  or That")
  28       evalua tion = Eva luation.ne w(claim: c laim,
  29                                      evaluati on_spec: e valuation_ spec,
  30                                      doc: bui ld(:diabet es_doc).do c,
  31                                      user: us er)
  32       claim. contention s.first.ev aluations  << evaluat ion
  33       ENV['V LER_DAS_UR L'] = "htt p://exampl e.com/api/ v1"
  34       expect (subject). to_not rec eive(:buil d_request)
  35       expect {subject.p erform(eva luation)}. to change{ Evaluation Log.count} .by(1)
  36     end
  37  
  38     it "does  not send  data to vl erdas when  evaluatio n xml is i nvalid, an d logs the  failure"  do
  39       allow( @evaluatio n).to rece ive(:to_xm l) { "meow s" }
  40       expect (subject). to_not rec eive(:buil d_request)
  41       expect {subject.p erform(@ev aluation)} .to change {Evaluatio nLog.count }.by(1)
  42     end
  43  
  44     it "send s data to  vlerdas" d o
  45       stub_r equest(:po st, ENV['V LER_DAS_UR L']).with  {|request|
  46         head ers = requ est.header s.map {|k, v| "#{k}:  #{v}"}.joi n("\r\n")
  47         msgb ody = "#{h eaders}\r\ n\r\n#{req uest.body} "
  48  
  49         # To  test that  it's a va lid multip art mime m essage, us e the mail  module
  50         mail  = Mail.ne w(msgbody)
  51         expe ct(mail.mu ltipart?)
  52         expe ct(mail.co ntent_type ).to match  "multipar t/form-dat a"
  53         expe ct(mail.he ader["Acce pt"].value ).to match  "applicat ion/json"
  54         expe ct(mail.pa rts.length ).to eq 1
  55  
  56         mp =  mail.part s[0]
  57         expe ct(mp.cont ent_type). to match " applicatio n/xml"
  58         expe ct(mp.cont ent_dispos ition).to  match "fil ename=cui- #{@evaluat ion.guid}. xml"
  59         expe ct(mp.cont ent_dispos ition).to  match "nam e=file"
  60  
  61         expe ct(request .uri.host) .to eq "ex ample.com"
  62         expe ct(request .uri.path) .to eq "/a pi/v1"
  63         expe ct(request .body).to  match '^-- 3e776445'
  64       }
  65       subjec t.perform( @evaluatio n)
  66     end
  67  
  68     it "logs  to the ev aluation l og table"  do
  69       stub_r equest(:po st, ENV['V LER_DAS_UR L']).with  {|request|
  70         head ers = requ est.header s.map {|k, v| "#{k}:  #{v}"}.joi n("\r\n")
  71         msgb ody = "#{h eaders}\r\ n\r\n#{req uest.body} "
  72       }
  73       expect {subject.p erform(@ev aluation)} .to change {Evaluatio nLog.count }.by(1)
  74     end
  75  
  76     context  "SSL Envir onment Var iables" do
  77       it "do esn't use  :peer if n o keyfile  is present " do
  78         ENV. delete("VL ER_DAS_KEY FILE")
  79  
  80         allo w(@evaluat ion).to re ceive(:ren der_html). and_return  "<html>si mple</html >"
  81         allo w(@evaluat ion).to re ceive(:to_ xml).and_r eturn "<xm l>simple</ xml>"
  82  
  83         expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to  receive(:v erify_mode =).with(:n one)
  84  
  85         stub _request(: post, ENV[ 'VLER_DAS_ URL'])
  86         allo w(@evaluat ion).to re ceive(:val idate_xml) .and_retur n([])
  87         subj ect.perfor m(@evaluat ion)
  88       end
  89  
  90       it "us es a keyfi le only if  keyfile i s present"  do
  91         ENV[ 'VLER_DAS_ URL'] = "h ttps://exa mple.com/a pi/v1"
  92         ENV[ "VLER_DAS_ KEYFILE"]  = "/tmp/ke y.crt"
  93         ENV[ "VLER_DAS_ KEYPASS"]  = "passwor d"
  94         ENV[ "VLER_DAS_ CERT"] = " /a/cert/fi le"
  95         ENV[ "VLER_DAS_ CACERT"] =  "/a/ca/ce rt"
  96  
  97         allo w(@evaluat ion).to re ceive(:ren der_html). and_return  "<html>si mple</html >"
  98         allo w(@evaluat ion).to re ceive(:to_ xml).and_r eturn "<xm l>simple</ xml>"
  99  
  100         expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to  receive(:c ert_key_fi le=).with( ENV["VLER_ DAS_KEYFIL E"]) { ENV ["VLER_DAS _KEYFILE"]  }
  101         expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to  receive(:c ert_key_pa ssword=).w ith(ENV["V LER_DAS_KE YPASS"]) {  ENV["VLER _DAS_KEYPA SS"] }
  102         expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to  receive(:c ert_file=) .with(ENV[ "VLER_DAS_ CERT"]) {  ENV["VLER_ DAS_CERT"]  }
  103         expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to  receive(:c a_cert_fil e=).with(E NV["VLER_D AS_CACERT" ]) { ENV[" VLER_DAS_C ACERT"] }
  104  
  105         stub _request(: post, ENV[ 'VLER_DAS_ URL'])
  106         allo w(@evaluat ion).to re ceive(:val idate_xml) .and_retur n([])
  107         subj ect.perfor m(@evaluat ion)
  108       end
  109     end
  110   end