{{#if (or @model.targets this.search)}}
-
-
-
+
+
+
-
-
+
-
-
-
- {{#each this.searchItems as |item|}}
-
- {{item}}
-
- {{/each}}
-
-
-
- {{t 'actions.yes'}}
- {{t 'actions.no'}}
-
-
-
- {{t 'resources.target.types.tcp'}}
- {{t 'resources.target.types.ssh'}}
-
-
-
+
+ {{#each this.searchItems as |item|}}
+
+ {{item}}
+
+ {{/each}}
+
+
+
+ {{t 'actions.yes'}}
+ {{t 'actions.no'}}
+
+
+
+ {{t 'resources.target.types.tcp'}}
+ {{t 'resources.target.types.ssh'}}
+
+
{{#if @model.targets}}
+
+
{{/if}}
{{#if this.noResults}}
diff --git a/ui/desktop/electron-app/src/ipc/handlers.js b/ui/desktop/electron-app/src/ipc/handlers.js
index 60f61a27e..5cd7c59fa 100644
--- a/ui/desktop/electron-app/src/ipc/handlers.js
+++ b/ui/desktop/electron-app/src/ipc/handlers.js
@@ -146,7 +146,7 @@ handle('searchClientDaemon', async (request) =>
* Check to see if the client daemon is running. We use the presence of a
* socket path as a proxy for whether the daemon is running.
*/
-handle('isClientDaemonRunning', async (request) =>
+handle('isClientDaemonRunning', async () =>
Boolean(clientDaemonManager.socketPath),
);
diff --git a/ui/desktop/tests/acceptance/projects/sessions/index-test.js b/ui/desktop/tests/acceptance/projects/sessions/index-test.js
index a071d20a8..18fc711b3 100644
--- a/ui/desktop/tests/acceptance/projects/sessions/index-test.js
+++ b/ui/desktop/tests/acceptance/projects/sessions/index-test.js
@@ -15,17 +15,18 @@ import {
authenticateSession,
invalidateSession,
} from 'ember-simple-auth/test-support';
-import sinon from 'sinon';
import {
STATUS_SESSION_ACTIVE,
STATUS_SESSION_PENDING,
STATUS_SESSION_CANCELING,
STATUS_SESSION_TERMINATED,
} from 'api/models/session';
+import setupStubs from 'api/test-support/handlers/client-daemon-search';
-module('Acceptance | projects | sessions', function (hooks) {
+module('Acceptance | projects | sessions | index', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
+ setupStubs(hooks);
const instances = {
scopes: {
@@ -40,12 +41,6 @@ module('Acceptance | projects | sessions', function (hooks) {
session: null,
};
- const stubs = {
- global: null,
- org: null,
- ipcService: null,
- };
-
const urls = {
scopes: {
global: null,
@@ -77,17 +72,16 @@ module('Acceptance | projects | sessions', function (hooks) {
// create scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
- stubs.global = { id: 'global', type: 'global' };
+ const globalScope = { id: 'global', type: 'global' };
instances.scopes.org = this.server.create('scope', {
type: 'org',
- scope: stubs.global,
+ scope: globalScope,
});
- stubs.org = { id: instances.scopes.org.id, type: 'org' };
+ const orgScope = { id: instances.scopes.org.id, type: 'org' };
instances.scopes.project = this.server.create('scope', {
type: 'project',
- scope: stubs.org,
+ scope: orgScope,
});
- stubs.project = { id: instances.scopes.project.id, type: 'project' };
instances.authMethods.global = this.server.create('auth-method', {
scope: instances.scopes.global,
@@ -120,12 +114,7 @@ module('Acceptance | projects | sessions', function (hooks) {
this.owner.register('service:browser/window', WindowMockIPC);
setDefaultClusterUrl(this);
- const ipcService = this.owner.lookup('service:ipc');
- stubs.ipcService = sinon.stub(ipcService, 'invoke');
- });
-
- hooks.afterEach(function () {
- sinon.restore();
+ this.ipcStub.withArgs('isClientDaemonRunning').returns(false);
});
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
@@ -299,7 +288,7 @@ module('Acceptance | projects | sessions', function (hooks) {
test('cancelling a session shows success alert', async function (assert) {
assert.expect(1);
- stubs.ipcService.withArgs('stop');
+ this.ipcStub.withArgs('stop');
await visit(urls.sessions);
await click('tbody tr:first-child td:last-child button');
@@ -309,7 +298,7 @@ module('Acceptance | projects | sessions', function (hooks) {
test('cancelling a session keeps you on the sessions list screen', async function (assert) {
assert.expect(1);
- stubs.ipcService.withArgs('stop');
+ this.ipcStub.withArgs('stop');
await visit(urls.sessions);
await click('tbody tr:first-child td:last-child button');
@@ -329,7 +318,7 @@ module('Acceptance | projects | sessions', function (hooks) {
test('cancelling a session with ipc error shows notification', async function (assert) {
assert.expect(1);
- stubs.ipcService.withArgs('stop').throws();
+ this.ipcStub.withArgs('stop').throws();
await visit(urls.sessions);
await click('tbody tr:first-child td:last-child button');
diff --git a/ui/desktop/tests/acceptance/projects/sessions/session-test.js b/ui/desktop/tests/acceptance/projects/sessions/session-test.js
index e69858e0c..332905aa1 100644
--- a/ui/desktop/tests/acceptance/projects/sessions/session-test.js
+++ b/ui/desktop/tests/acceptance/projects/sessions/session-test.js
@@ -12,13 +12,14 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
-import sinon from 'sinon';
import WindowMockIPC from '../../../helpers/window-mock-ipc';
import { STATUS_SESSION_ACTIVE } from 'api/models/session';
+import setupStubs from 'api/test-support/handlers/client-daemon-search';
module('Acceptance | projects | sessions | session', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
+ setupStubs(hooks);
const TARGET_CONNECT_BUTTON = '[data-test-target-detail-connect-button]';
@@ -35,12 +36,6 @@ module('Acceptance | projects | sessions | session', function (hooks) {
session: null,
};
- const stubs = {
- global: null,
- org: null,
- ipcService: null,
- };
-
const urls = {
scopes: {
global: null,
@@ -70,17 +65,17 @@ module('Acceptance | projects | sessions | session', function (hooks) {
// create scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
- stubs.global = { id: 'global', type: 'global' };
+ const globalScope = { id: 'global', type: 'global' };
instances.scopes.org = this.server.create('scope', {
type: 'org',
- scope: stubs.global,
+ scope: globalScope,
});
- stubs.org = { id: instances.scopes.org.id, type: 'org' };
+ const orgScope = { id: instances.scopes.org.id, type: 'org' };
instances.scopes.project = this.server.create('scope', {
type: 'project',
- scope: stubs.org,
+ scope: orgScope,
});
- stubs.project = { id: instances.scopes.project.id, type: 'project' };
+
instances.hostCatalog = this.server.create('host-catalog', {
scope: instances.scopes.project,
});
@@ -119,12 +114,10 @@ module('Acceptance | projects | sessions | session', function (hooks) {
this.owner.register('service:browser/window', WindowMockIPC);
setDefaultClusterUrl(this);
- const ipcService = this.owner.lookup('service:ipc');
- stubs.ipcService = sinon.stub(ipcService, 'invoke');
+ this.ipcStub.withArgs('isClientDaemonRunning').returns(false);
});
hooks.afterEach(function () {
- sinon.restore();
// reset onUncaughtException to original state
QUnit.onUncaughtException = originalUncaughtException;
});
@@ -140,8 +133,8 @@ module('Acceptance | projects | sessions | session', function (hooks) {
test('visiting session with no credentials', async function (assert) {
assert.expect(4);
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
address: 'a_123',
port: 'p_123',
@@ -162,8 +155,8 @@ module('Acceptance | projects | sessions | session', function (hooks) {
test('visiting a session that does not have permissions to read a host', async function (assert) {
assert.expect(1);
this.server.get('/hosts/:id', () => new Response(403));
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
host_id: 'h_123',
address: 'a_123',
@@ -185,8 +178,8 @@ module('Acceptance | projects | sessions | session', function (hooks) {
};
this.server.get('/sessions/:id', () => new Response(403));
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
host_id: 'h_123',
address: 'a_123',
@@ -220,7 +213,6 @@ module('Acceptance | projects | sessions | session', function (hooks) {
test('cancelling a session shows success alert', async function (assert) {
assert.expect(1);
- stubs.ipcService.withArgs('stop');
await visit(urls.session);
await click('[data-test-session-detail-cancel-button]');
@@ -230,7 +222,6 @@ module('Acceptance | projects | sessions | session', function (hooks) {
test('cancelling a session takes you to the targets list screen', async function (assert) {
assert.expect(1);
- stubs.ipcService.withArgs('stop');
await visit(urls.session);
await click('[data-test-session-detail-cancel-button]');
@@ -250,7 +241,7 @@ module('Acceptance | projects | sessions | session', function (hooks) {
test('cancelling a session with ipc error shows notification', async function (assert) {
assert.expect(1);
- stubs.ipcService.withArgs('stop').throws();
+ this.ipcStub.withArgs('stop').throws();
await visit(urls.session);
await click('[data-test-session-detail-cancel-button]');
diff --git a/ui/desktop/tests/acceptance/projects/targets/index-test.js b/ui/desktop/tests/acceptance/projects/targets/index-test.js
index 62dd7db73..264b96689 100644
--- a/ui/desktop/tests/acceptance/projects/targets/index-test.js
+++ b/ui/desktop/tests/acceptance/projects/targets/index-test.js
@@ -12,19 +12,19 @@ import {
} from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import { Response } from 'miragejs';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import sinon from 'sinon';
import WindowMockIPC from '../../../helpers/window-mock-ipc';
import {
authenticateSession,
invalidateSession,
currentSession,
} from 'ember-simple-auth/test-support';
+import setupStubs from 'api/test-support/handlers/client-daemon-search';
module('Acceptance | projects | targets | index', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
+ setupStubs(hooks);
let getTargetCount;
@@ -51,12 +51,6 @@ module('Acceptance | projects | targets | index', function (hooks) {
session: null,
};
- const stubs = {
- global: null,
- org: null,
- ipcService: null,
- };
-
const urls = {
scopes: {
global: null,
@@ -87,17 +81,16 @@ module('Acceptance | projects | targets | index', function (hooks) {
// Generate scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
- stubs.global = { id: 'global', type: 'global' };
+ const globalScope = { id: 'global', type: 'global' };
instances.scopes.org = this.server.create('scope', {
type: 'org',
- scope: stubs.global,
+ scope: globalScope,
});
- stubs.org = { id: instances.scopes.org.id, type: 'org' };
+ const orgScope = { id: instances.scopes.org.id, type: 'org' };
instances.scopes.project = this.server.create('scope', {
type: 'project',
- scope: stubs.org,
+ scope: orgScope,
});
- stubs.project = { id: instances.scopes.project.id, type: 'project' };
// Generate resources
instances.authMethods.global = this.server.create('auth-method', {
@@ -137,12 +130,8 @@ module('Acceptance | projects | targets | index', function (hooks) {
this.owner.register('service:browser/window', WindowMockIPC);
setDefaultClusterUrl(this);
- const ipcService = this.owner.lookup('service:ipc');
- stubs.ipcService = sinon.stub(ipcService, 'invoke');
- });
-
- hooks.afterEach(function () {
- sinon.restore();
+ this.ipcStub.withArgs('isClientDaemonRunning').returns(true);
+ this.stubClientDaemonSearch('targets');
});
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
@@ -182,7 +171,9 @@ module('Acceptance | projects | targets | index', function (hooks) {
test('visiting targets list view with no targets', async function (assert) {
assert.expect(1);
- this.server.get('/targets', () => new Response(200));
+ this.server.db.targets.remove();
+ this.stubClientDaemonSearch('targets');
+
await visit(urls.projects);
await click(`[href="${urls.targets}"]`);
@@ -194,6 +185,8 @@ module('Acceptance | projects | targets | index', function (hooks) {
assert.expect(1);
instances.target.authorized_actions =
instances.target.authorized_actions.filter((item) => item !== 'read');
+ this.stubClientDaemonSearch('targets');
+
await visit(urls.projects);
await click(`[href="${urls.targets}"]`);
@@ -223,6 +216,8 @@ module('Acceptance | projects | targets | index', function (hooks) {
instances.target.authorized_actions.filter(
(item) => item !== 'authorize-session',
);
+ this.stubClientDaemonSearch('targets');
+
await visit(urls.projects);
await click(`[href="${urls.targets}"]`);
@@ -237,8 +232,8 @@ module('Acceptance | projects | targets | index', function (hooks) {
test('user is redirected to target details page when unable to connect from list view if they have read and authorize-session permissions', async function (assert) {
assert.expect(3);
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').rejects();
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').rejects();
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
@@ -255,8 +250,9 @@ module('Acceptance | projects | targets | index', function (hooks) {
assert.expect(2);
instances.target.authorized_actions =
instances.target.authorized_actions.filter((item) => item !== 'read');
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.stubClientDaemonSearch('targets');
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
address: 'a_123',
port: 'p_123',
@@ -278,8 +274,9 @@ module('Acceptance | projects | targets | index', function (hooks) {
assert.expect(5);
instances.target.authorized_actions =
instances.target.authorized_actions.filter((item) => item !== 'read');
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').rejects();
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').rejects();
+ this.stubClientDaemonSearch('targets');
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
diff --git a/ui/desktop/tests/acceptance/projects/targets/target-test.js b/ui/desktop/tests/acceptance/projects/targets/target-test.js
index e77bf9b66..9c66d7aef 100644
--- a/ui/desktop/tests/acceptance/projects/targets/target-test.js
+++ b/ui/desktop/tests/acceptance/projects/targets/target-test.js
@@ -7,13 +7,14 @@ import { module, test } from 'qunit';
import { visit, currentURL, click, find } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import sinon from 'sinon';
import { authenticateSession } from 'ember-simple-auth/test-support';
import WindowMockIPC from '../../../helpers/window-mock-ipc';
+import setupStubs from 'api/test-support/handlers/client-daemon-search';
module('Acceptance | projects | targets | target', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
+ setupStubs(hooks);
const TARGET_CONNECT_BUTTON = '[data-test-target-detail-connect-button]';
const TARGET_QUICK_CONNECT_BUTTON = '[data-test-host-quick-connect]';
@@ -40,12 +41,6 @@ module('Acceptance | projects | targets | target', function (hooks) {
targetWithTwoHosts: null,
};
- const stubs = {
- global: null,
- org: null,
- ipcService: null,
- };
-
const urls = {
scopes: {
global: null,
@@ -72,17 +67,16 @@ module('Acceptance | projects | targets | target', function (hooks) {
// Generate scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
- stubs.global = { id: 'global', type: 'global' };
+ const globalScope = { id: 'global', type: 'global' };
instances.scopes.org = this.server.create('scope', {
type: 'org',
- scope: stubs.global,
+ scope: globalScope,
});
- stubs.org = { id: instances.scopes.org.id, type: 'org' };
+ const orgScope = { id: instances.scopes.org.id, type: 'org' };
instances.scopes.project = this.server.create('scope', {
type: 'project',
- scope: stubs.org,
+ scope: orgScope,
});
- stubs.project = { id: instances.scopes.project.id, type: 'project' };
// Generate resources
instances.authMethods.global = this.server.create('auth-method', {
@@ -129,18 +123,14 @@ module('Acceptance | projects | targets | target', function (hooks) {
this.owner.register('service:browser/window', WindowMockIPC);
setDefaultClusterUrl(this);
- const ipcService = this.owner.lookup('service:ipc');
- stubs.ipcService = sinon.stub(ipcService, 'invoke');
- });
-
- hooks.afterEach(function () {
- sinon.restore();
+ this.ipcStub.withArgs('isClientDaemonRunning').returns(true);
+ this.stubClientDaemonSearch('targets');
});
test('user can connect to a target with an address', async function (assert) {
assert.expect(3);
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
address: 'localhost',
port: 'p_123',
@@ -159,7 +149,7 @@ module('Acceptance | projects | targets | target', function (hooks) {
test('handles cli error on connect', async function (assert) {
assert.expect(4);
- stubs.ipcService.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('cliExists').returns(true);
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
await visit(urls.targets);
@@ -175,8 +165,8 @@ module('Acceptance | projects | targets | target', function (hooks) {
test('handles connect error', async function (assert) {
assert.expect(4);
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').rejects();
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').rejects();
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
await visit(urls.targets);
@@ -192,7 +182,7 @@ module('Acceptance | projects | targets | target', function (hooks) {
test('user can retry on error', async function (assert) {
assert.expect(1);
- stubs.ipcService.withArgs('cliExists').rejects();
+ this.ipcStub.withArgs('cliExists').rejects();
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
@@ -208,8 +198,8 @@ module('Acceptance | projects | targets | target', function (hooks) {
test('user can connect to a target with one host', async function (assert) {
assert.expect(2);
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
address: 'a_123',
port: 'p_123',
@@ -228,8 +218,8 @@ module('Acceptance | projects | targets | target', function (hooks) {
test('user can connect to a target with two hosts using host modal', async function (assert) {
assert.expect(3);
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
address: 'a_123',
port: 'p_123',
@@ -275,8 +265,8 @@ module('Acceptance | projects | targets | target', function (hooks) {
test('user can connect to a target without read permissions for host-set', async function (assert) {
assert.expect(1);
this.server.get('/host-sets/:id', () => new Response(403));
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
address: 'a_123',
port: 'p_123',
@@ -294,8 +284,8 @@ module('Acceptance | projects | targets | target', function (hooks) {
test('user can connect to a target without read permissions for host', async function (assert) {
assert.expect(1);
this.server.get('/hosts/:id', () => new Response(403));
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
session_id: instances.session.id,
address: 'a_123',
port: 'p_123',
diff --git a/ui/desktop/tests/acceptance/scopes-test.js b/ui/desktop/tests/acceptance/scopes-test.js
index 6cf788a89..e8c5489e2 100644
--- a/ui/desktop/tests/acceptance/scopes-test.js
+++ b/ui/desktop/tests/acceptance/scopes-test.js
@@ -9,17 +9,18 @@ import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import sinon from 'sinon';
import {
currentSession,
authenticateSession,
invalidateSession,
} from 'ember-simple-auth/test-support';
import WindowMockIPC from '../helpers/window-mock-ipc';
+import setupStubs from 'api/test-support/handlers/client-daemon-search';
module('Acceptance | scopes', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
+ setupStubs(hooks);
const APP_STATE_TITLE = '.hds-application-state__title';
@@ -36,12 +37,6 @@ module('Acceptance | scopes', function (hooks) {
session: null,
};
- const stubs = {
- global: null,
- org: null,
- ipcService: null,
- };
-
const urls = {
index: '/',
clusterUrl: '/cluster-url',
@@ -78,21 +73,20 @@ module('Acceptance | scopes', function (hooks) {
// create scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
- stubs.global = { id: 'global', type: 'global' };
+ const globalScope = { id: 'global', type: 'global' };
instances.scopes.org = this.server.create('scope', {
type: 'org',
- scope: stubs.global,
+ scope: globalScope,
});
instances.scopes.org2 = this.server.create('scope', {
type: 'org',
- scope: stubs.global,
+ scope: globalScope,
});
- stubs.org = { id: instances.scopes.org.id, type: 'org' };
+ const orgScope = { id: instances.scopes.org.id, type: 'org' };
instances.scopes.project = this.server.create('scope', {
type: 'project',
- scope: stubs.org,
+ scope: orgScope,
});
- stubs.project = { id: instances.scopes.project.id, type: 'project' };
instances.authMethods.global = this.server.create('auth-method', {
scope: instances.scopes.global,
@@ -134,12 +128,8 @@ module('Acceptance | scopes', function (hooks) {
this.owner.register('service:browser/window', WindowMockIPC);
setDefaultClusterUrl(this);
- const ipcService = this.owner.lookup('service:ipc');
- stubs.ipcService = sinon.stub(ipcService, 'invoke');
- });
-
- hooks.afterEach(function () {
- sinon.restore();
+ this.ipcStub.withArgs('isClientDaemonRunning').returns(true);
+ this.stubClientDaemonSearch('targets');
});
test('visiting index', async function (assert) {
@@ -190,6 +180,7 @@ module('Acceptance | scopes', function (hooks) {
test('can navigate among org scopes via header navigation', async function (assert) {
assert.expect(3);
+ this.stubClientDaemonSearch('targets', 'targets', 'targets', 'targets');
await visit(urls.targets);
await click('.rose-header-nav .rose-dropdown a:nth-of-type(2)');
@@ -224,7 +215,8 @@ module('Acceptance | scopes', function (hooks) {
test('visiting empty targets', async function (assert) {
assert.expect(1);
- this.server.get('/targets', () => new Response(200));
+ this.server.db.targets.remove();
+ this.stubClientDaemonSearch('targets');
await visit(urls.targets);
@@ -233,8 +225,8 @@ module('Acceptance | scopes', function (hooks) {
test.skip('connecting to a target', async function (assert) {
assert.expect(3);
- stubs.ipcService.withArgs('cliExists').returns(true);
- stubs.ipcService.withArgs('connect').returns({
+ this.ipcStub.ipcService.withArgs('cliExists').returns(true);
+ this.ipcStub.ipcService.withArgs('connect').returns({
session_id: instances.session.id,
address: 'a_123',
port: 'p_123',