Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

digest-fetch.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. process.env.NO_DEPRECATION = 'digest-fetch';
  2. var after = require('after')
  3. var assert = require('assert')
  4. var DigestFetch = require('../')
  5. describe('digest-fetch', function(){
  6. it('get function', function(){
  7. assert.equal(typeof DigestFetch, 'function')
  8. })
  9. it('should success', function() {
  10. var client = new DigestFetch('test', '123')
  11. assert.equal(typeof client.fetch, 'function')
  12. client.parseAuth('')
  13. client.addAuth('', {headers: {}})
  14. assert.equal(client.digest.nc, 0)
  15. })
  16. it('test parse string fields', function () {
  17. assert.equal(DigestFetch.parse('a=,', 'a'), '')
  18. assert.equal(DigestFetch.parse('a=v1,', 'a'), 'v1')
  19. assert.equal(DigestFetch.parse('a=""', 'b'), null)
  20. assert.equal(DigestFetch.parse('a="v2",', 'a'), 'v2')
  21. assert.equal(DigestFetch.parse('a="v1,v2"', 'a'), 'v1,v2')
  22. const client = new DigestFetch("", "")
  23. client.parseAuth('qop=auth-int,realm=test')
  24. assert.equal(client.digest.realm, "test")
  25. client.parseAuth('qop="auth",realm="v1 v2"')
  26. assert.equal(client.digest.realm, "v1 v2")
  27. })
  28. it('test qop parsing', function () {
  29. var client = new DigestFetch('test', '123')
  30. assert.equal(client.parseQop('qop=auth,realm='), 'auth')
  31. assert.equal(client.parseQop('qop="auth",realm='), 'auth')
  32. assert.equal(client.parseQop('qop="auth,auth-int",realm='), 'auth')
  33. assert.equal(client.parseQop('qop="auth-int",realm='), 'auth-int')
  34. })
  35. })