Skip to content

Commit dc5dfe6

Browse files
committed
use couchdb version to expect info response
1 parent 268a262 commit dc5dfe6

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
GET /
2+
accept-encoding: gzip, deflate
3+
accept: application/json
4+
5+
HTTP/1.1 200 OK
6+
cache-control: must-revalidate
7+
connection: close
8+
content-length: 247
9+
content-type: application/json
10+
date: Fri, 05 Dec 2025 16:56:48 GMT
11+
server: CouchDB/3.5.1 (Erlang OTP/26)
12+
x-couch-request-id: 18b668d415
13+
x-couchdb-body-time: 0
14+
15+
{"couchdb":"Welcome","version":"3.5.1","git_sha":"44f6a43d8","uuid":"8507dcd80018afd3e0af696947fb57a0","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

test/routes/deprecated-spec.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
const debug = require('debug')('test:deprecated');
22
const { expect } = require('chai');
3+
const config = require('config');
34
const path = require('path');
45
const replay = require('replay');
56
const supertest = require('supertest');
67
// eslint-disable-next-line global-require
78
const authWebService = process.env.URL || require('../../auth_service');
89

10+
const REPLAY = process.env.REPLAY || '';
11+
912
// eslint-disable-next-line no-underscore-dangle
1013
const originalLocalhosts = replay._localhosts;
1114
const requestId = 'deprecated-spec';
1215
replay.fixtures = path.join(__dirname, '/../fixtures/replay');
16+
let couchDBInfo;
1317

1418
describe('/ deprecated', () => {
1519
const testUsername = process.env.REPLAY ? `test${Date.now()}` : 'test1637710294972';
@@ -19,6 +23,16 @@ describe('/ deprecated', () => {
1923
replay._localhosts = new Set(['127.0.0.1', '::1']);
2024
// eslint-disable-next-line no-underscore-dangle
2125
debug('before replay localhosts', replay._localhosts);
26+
27+
return supertest(config.usersDbConnection.url)
28+
.get('/')
29+
.set('Accept', 'application/json')
30+
.then((res) => {
31+
expect(res.status).to.equal(200);
32+
debug('couchdb version', res.body);
33+
couchDBInfo = res.body;
34+
expect(couchDBInfo.version).to.be.a('string', JSON.stringify(couchDBInfo));
35+
});
2236
});
2337
after(() => {
2438
// eslint-disable-next-line no-underscore-dangle
@@ -84,7 +98,8 @@ describe('/ deprecated', () => {
8498
],
8599
},
86100
info: {
87-
authentication_handlers: ['cookie', 'default'],
101+
authentication_db: couchDBInfo.version = '1.6.1' ? '_users' : undefined,
102+
authentication_handlers: couchDBInfo.version = '1.6.1' ? ['oauth', 'cookie', 'default'] : ['cookie', 'default'],
88103
authenticated: 'default',
89104
},
90105
}, 'should have roles');

0 commit comments

Comments
 (0)