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-basic.js 997B

123456789101112131415161718192021222324252627282930
  1. process.env.NO_DEPRECATION = 'digest-fetch';
  2. var after = require('after')
  3. var assert = require('assert')
  4. var DigestFetch = require('../')
  5. var factory = require('./test-server')
  6. var chai = require('chai')
  7. var expect = chai.expect
  8. var chaiHttp = require('chai-http')
  9. chai.use(chaiHttp)
  10. chai.should()
  11. var app = factory.getApp()
  12. describe('digest-fetch', function(){
  13. it('Test Basic Authentication', function() {
  14. var client = new DigestFetch('test', 'test', { basic: true })
  15. const auth = client.addBasicAuth().headers.Authorization
  16. chai.request(app).get('/basic').set('Authorization', auth).then(res => {
  17. expect(res).to.have.status(200)
  18. })
  19. })
  20. it('Test Basic Authentication with wrong credential', function() {
  21. var client = new DigestFetch('test', 'test-null', { basic: true })
  22. const auth = client.addBasicAuth().headers.Authorization
  23. chai.request(app).get('/basic').set('Authorization', auth).then(res => {
  24. expect(res).to.have.status(401)
  25. })
  26. })
  27. })