zoom.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const nock = require('nock')
  2. const { getBasicAuthHeader } = require('../../src/server/helpers/utils')
  3. module.exports.expects = {
  4. listPath: 'DUMMY-UUID%3D%3D',
  5. itemName: 'DUMMY TOPIC - shared screen with speaker view (2020-05-29, 13:23).mp4',
  6. itemId: 'DUMMY-UUID%3D%3D__DUMMY-FILE-ID',
  7. itemRequestPath: 'DUMMY-UUID%3D%3D?recordingId=DUMMY-FILE-ID',
  8. itemIcon: 'video',
  9. localZoomKey: 'zoom_key',
  10. localZoomSecret: 'zoom_secret',
  11. localZoomVerificationToken: 'zoom_verfication_token',
  12. remoteZoomKey: 'REMOTE-ZOOM-KEY',
  13. remoteZoomSecret: 'REMOTE-ZOOM-SECRET',
  14. remoteZoomVerificationToken: 'REMOTE-ZOOM-VERIFICATION-TOKEN',
  15. }
  16. module.exports.nockZoomRecordings = ({ times = 1 } = {}) => {
  17. nock('https://zoom.us').get('/v2/meetings/DUMMY-UUID%3D%3D/recordings').times(times).reply(200, {
  18. uuid: 'DUMMY-UUID==',
  19. id: 12345678900,
  20. account_id: 'DUMMY-ACCOUNT-ID',
  21. host_id: 'DUMMY-HOST-ID',
  22. topic: 'DUMMY TOPIC',
  23. type: 2,
  24. start_time: '2020-05-29T13:19:40Z',
  25. timezone: 'Europe/Amsterdam',
  26. duration: 0,
  27. total_size: 723389,
  28. recording_count: 4,
  29. recording_files:
  30. [
  31. {
  32. id: 'DUMMY-FILE-ID',
  33. meeting_id: 'DUMMY-UUID==',
  34. recording_start: '2020-05-29T13:23:57Z',
  35. recording_end: '2020-05-29T13:24:02Z',
  36. file_type: 'MP4',
  37. file_size: 758051,
  38. play_url: 'https://us02web.zoom.us/rec/play/DUMMY-DOWNLOAD-PATH',
  39. download_url: 'https://us02web.zoom.us/rec/download/DUMMY-DOWNLOAD-PATH',
  40. status: 'completed',
  41. recording_type: 'shared_screen_with_speaker_view',
  42. },
  43. ],
  44. })
  45. }
  46. module.exports.nockZoomRevoke = ({ key, secret }) => {
  47. // eslint-disable-next-line func-names
  48. nock('https://zoom.us').post('/oauth/revoke?token=token+value').reply(function () {
  49. const { headers } = this.req
  50. const expected = getBasicAuthHeader(key, secret)
  51. const success = headers.authorization === expected
  52. return success ? [200, { status: 'success' }] : [400]
  53. })
  54. }