Merge branch 'main' into add-aws-azure-attrs

This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-02-08 13:01:30 -08:00
commit 168e6e8700
2 files changed
+22 -4

No files matched your search

@@ -17,6 +17,14 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route {
// =methods
/**
* Rollback/destroy any new, unsaved instances from this route before
* creating another.
*/
beforeModel() {
if (this.currentModel?.isNew) this.currentModel.rollbackAttributes();
}
/**
* Creates a new unsaved host catalog belonging to the current scope.
* @return {HostCatalogModel}
@@ -97,7 +97,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.equal(gethostCatalogCount(), count + 1);
});
test('Users can cancel create new host catalogs', async function (assert) {
test('Users can cancel creation of new static host catalogs', async function (assert) {
assert.expect(2);
const count = gethostCatalogCount();
await visit(urls.newStaticHostCatalog);
@@ -107,7 +107,17 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.equal(gethostCatalogCount(), count);
});
test('Users can navigate to new host catalogs route with proper authorization', async function (assert) {
test('Users can cancel creation of new dynamic host catalogs', async function (assert) {
assert.expect(2);
const count = gethostCatalogCount();
await visit(urls.newDynamicHostCatalog);
await fillIn('[name="name"]', 'random string');
await click('.rose-form-actions [type="button"]');
assert.equal(currentURL(), urls.hostCatalogs);
assert.equal(gethostCatalogCount(), count);
});
test('Users can navigate to new static host catalogs route with proper authorization', async function (assert) {
assert.expect(2);
await visit(urls.hostCatalogs);
assert.ok(
@@ -118,7 +128,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.ok(find(`[href="${urls.newHostCatalog}"]`));
});
test('Users cannot navigate to new host catalogs route without proper authorization', async function (assert) {
test('Users cannot navigate to new static host catalogs route without proper authorization', async function (assert) {
assert.expect(2);
instances.scopes.project.authorized_collection_actions['host-catalogs'] =
[];
@@ -131,7 +141,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.notOk(find(`[href="${urls.newStaticHostCatalog}"]`));
});
test('saving a new host catalog with invalid fields displays error messages', async function (assert) {
test('saving a new static host catalog with invalid fields displays error messages', async function (assert) {
assert.expect(2);
this.server.post('/host-catalogs', () => {
return new Response(