|
474 | 474 | end |
475 | 475 |
|
476 | 476 | context "includes the checksum" do |
477 | | - let(:params) { { :param1 => "value1", :param2 => "value2" } } |
478 | | - let(:checksum) { |
479 | | - # the hash can be sorted differently depending on the ruby version |
480 | | - if params.map{ |k,v| k }.join =~ /^param1/ |
481 | | - "67882ae54f49600f56f358c10d24697ef7d8c6b2" |
482 | | - else |
483 | | - "85a54e28e4ec18bfdcb214a73f74d35b09a84176" |
484 | | - end |
485 | | - } |
486 | | - subject { api.get_url(:join, params)[0] } |
487 | | - it { subject.should match(/checksum=#{checksum}$/) } |
| 477 | + context "when @sha256 is false or nil" do |
| 478 | + let(:params) { { param1: "value1", param2: "value2" } } |
| 479 | + let(:checksum) { |
| 480 | + # the hash can be sorted differently depending on the ruby version |
| 481 | + if params.map{ |k, v| k }.join =~ /^param1/ |
| 482 | + "67882ae54f49600f56f358c10d24697ef7d8c6b2" |
| 483 | + else |
| 484 | + "85a54e28e4ec18bfdcb214a73f74d35b09a84176" |
| 485 | + end |
| 486 | + } |
| 487 | + subject { api.get_url(:join, params)[0] } |
| 488 | + it('uses SHA1') { subject.should match(/checksum=#{checksum}$/) } |
| 489 | + end |
| 490 | + |
| 491 | + context "when @sha256 flag is true" do |
| 492 | + let(:api) { BigBlueButton::BigBlueButtonApi.new(url, secret, version, logger, true) } |
| 493 | + let(:params) { { param1: "value1", param2: "value2" } } |
| 494 | + let(:checksum) { |
| 495 | + # the hash can be sorted differently depending on the ruby version |
| 496 | + if params.map{ |k,v| k }.join =~ /^param1/ |
| 497 | + "0e7b1611809fad890a114dddae1a37fecf14c28971afc10ee3eac432da5b8b41" |
| 498 | + else |
| 499 | + "21bf2d24c27251c4b2b2f0d5dd4b966a2f16fbfc7882e102b44c6d67f728f0c8" |
| 500 | + end |
| 501 | + } |
| 502 | + subject { api.get_url(:join, params)[0] } |
| 503 | + it('uses SHA256') { subject.should match(/checksum=#{checksum}$/) } |
| 504 | + end |
488 | 505 | end |
489 | 506 | end |
490 | 507 | end |
|
0 commit comments