Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
test: use StandaloneDaemon in test/http-api,gateway
Browse files Browse the repository at this point in the history
This replaces durect use of HttpApi with StandaloneDaemon, restoring all
existing tests to operational state.

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
lidel committed Apr 11, 2019
1 parent 0b9076d commit 7c32da8
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions test/gateway/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const API = require('../../src/http')
const StandaloneDaemon = require('../../src/cli/standalone-daemon')
const loadFixture = require('aegir/fixtures')
const os = require('os')
const path = require('path')
Expand Down Expand Up @@ -33,7 +33,7 @@ describe('HTTP Gateway', function () {
this.timeout(60 * 1000)
const repoPath = path.join(os.tmpdir(), '/ipfs-' + hat())

http.api = new API({
http.api = new StandaloneDaemon({
repo: repoPath,
init: true,
config: {
Expand All @@ -60,7 +60,7 @@ describe('HTTP Gateway', function () {

await http.api.start()

gateway = http.api._gatewayServers[0]
gateway = http.api._httpApi._gatewayServers[0]

// QmbQD7EMEL1zeebwBsWEfA3ndgSS6F7S6iTuwuqasPgVRi
await http.api._ipfs.add([
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

before(async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

describe('/block/put', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
return api.inject({
method: 'GET',
url: '/api/v0/bootstrap/add/default'
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (http) => {

before(() => {
updatedConfig = () => JSON.parse(fs.readFileSync(configPath, 'utf8'))
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

after(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/dag.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

describe('/dag/get', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

describe('/findpeer', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

it('resolve ipfs.io dns', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

describe('/add', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

it('get the id', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

it('should publish a record', async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (http) => {
let api

before('api', () => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

describe('/new', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

describe('rm', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

it('returns 400 if both n and count are provided', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = (http) => {
const topicNotSubscribed = 'somethingRandom'

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

describe('/sub', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

it('should resolve a path and return a base2 encoded CID', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/inject/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = (http) => {
let api

before(() => {
api = http.api._apiServers[0]
api = http.api._httpApi._apiServers[0]
})

it('get the version', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/http-api/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const chai = require('chai')
const dirtyChai = require('dirty-chai')
chai.use(dirtyChai)
const hat = require('hat')
const API = require('../../src/http/index')
const StandaloneDaemon = require('../../src/cli/standalone-daemon')
const promisify = require('promisify-es6')
const ncp = promisify(require('ncp').ncp)
const path = require('path')
Expand All @@ -22,7 +22,7 @@ describe('HTTP API', () => {
let http = {}

const startHttpAPI = async (config) => {
http.api = new API({
http.api = new StandaloneDaemon({
repo: repoTests,
pass: hat(),
config,
Expand Down

0 comments on commit 7c32da8

Please sign in to comment.