fix spec
authordeepak1556 <hop2deep@gmail.com>
Mon, 18 Apr 2016 17:27:37 +0000 (22:57 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Mon, 18 Apr 2016 17:27:37 +0000 (22:57 +0530)
spec/api-app-spec.js
spec/fixtures/certificates/certs.cnf

index 1f54527..8923d2d 100644 (file)
@@ -95,7 +95,6 @@ describe('app module', function () {
 
     this.timeout(5000)
 
-    var port
     var w = null
     var certPath = path.join(__dirname, 'fixtures', 'certificates')
     var options = {
@@ -115,9 +114,6 @@ describe('app module', function () {
         res.end('authorized');
       }
     })
-    server.listen(0, '127.0.0.1', function () {
-      port = server.address().port
-    })
 
     afterEach(function () {
       if (w != null) {
@@ -141,9 +137,18 @@ describe('app module', function () {
         done()
       })
 
+      app.on('select-client-certificate', function (event, webContents, url, list, callback) {
+        assert.equal(list.length, 1)
+        assert.equal(list[0].issuerName, 'Intermediate CA')
+        callback(list[0])
+      })
+
       app.importClientCertificate(options, function (result) {
         assert(!result)
-        w.loadURL(`https://127.0.0.1:${port}`)
+        server.listen(0, '127.0.0.1', function () {
+          var port = server.address().port
+          w.loadURL(`https://127.0.0.1:${port}`)
+        })
       })
     })
   })
index d8b5c66..76ef8d0 100644 (file)
@@ -15,7 +15,7 @@ RANDFILE        = $dir/rand
 default_md      = sha256
 default_days    = 3650
 policy          = policy_anything
-preserve   = no
+preserve        = no
 
 [policy_anything]
 # Default signing policy
@@ -32,7 +32,7 @@ default_bits       = 2048
 default_md         = sha256
 string_mask        = utf8only
 distinguished_name = req_env_dn
-prompt = no
+prompt             = no
 
 [user_cert]
 basicConstraints = CA:FALSE