test/ssl-test_test.rb in ssl-test-1.0.0 vs test/ssl-test_test.rb in ssl-test-1.1.0

- old
+ new

@@ -4,46 +4,53 @@ describe SSLTest do describe '.test' do it "returns no error on valid SNI website" do valid, error, cert = SSLTest.test("https://www.mycs.com") + error.must_be_nil valid.must_equal true + cert.must_be_instance_of OpenSSL::X509::Certificate + end + + it "works with websites blocking http requests" do + valid, error, cert = SSLTest.test("https://obyava.ua") error.must_be_nil + valid.must_equal true cert.must_be_instance_of OpenSSL::X509::Certificate end it "returns error on self signed certificate" do valid, error, cert = SSLTest.test("https://kernelcoffee.org") - valid.must_equal false error.must_equal "error code 18: self signed certificate" + valid.must_equal false cert.must_be_instance_of OpenSSL::X509::Certificate end it "returns error on invalid host" do - valid, error, cert = SSLTest.test("https://staging.updown.io") + valid, error, cert = SSLTest.test("https://web1.updn.io") + error.must_equal 'hostname "web1.updn.io" does not match the server certificate' valid.must_equal false - error.must_equal 'hostname "staging.updown.io" does not match the server certificate' cert.must_be_instance_of OpenSSL::X509::Certificate end it "returns error on expired cert" do valid, error, cert = SSLTest.test("https://testssl-expire.disig.sk") - valid.must_equal false error.must_equal "error code 10: certificate has expired" + valid.must_equal false cert.must_be_instance_of OpenSSL::X509::Certificate end it "returns undetermined state on unhandled error" do valid, error, cert = SSLTest.test("https://pijoinlrfgind.com") + error.must_equal "SSL certificate test failed: Failed to open TCP connection to pijoinlrfgind.com:443 (getaddrinfo: Name or service not known)" valid.must_be_nil - error.must_equal "SSL certificate test failed: getaddrinfo: Name or service not known" cert.must_be_nil end it "stops on timeouts" do - valid, error, cert = SSLTest.test("https://approachio.com", open_timeout: 1) + valid, error, cert = SSLTest.test("https://updown.io", open_timeout: 0) + error.must_equal "SSL certificate test failed: Net::OpenTimeout" valid.must_be_nil - error.must_equal "SSL certificate test failed: execution expired" cert.must_be_nil end # Not implemented yet # it "returns error on revoked cert" do \ No newline at end of file