Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we handle orgs with no users #3098

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/frontend/app/store/reducers/users.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ function updateUserMissingRoles(users: IRequestEntityTypeState<APIResource<CfUse
// (via WrapperRequestActionSuccess). Therefore in order to avoid partial entities we need to stick the whole user set into the store
// including `missingRoles`.
const usersInResponse: IRequestEntityTypeState<APIResource<CfUser>> = action.response.entities[cfUserSchemaKey];
if (!usersInResponse) {
return users;
}

// Create a delta of the changes, this will ensure we only return an updated state if there are updates
const haveUpdatedUsers: boolean = Object.values(usersInResponse).reduce((changes, user) => {
Expand Down
40 changes: 39 additions & 1 deletion src/test-e2e/cloud-foundry/organizations-spaces-e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,43 @@ describe('CF - Manage Organizations and Spaces', () => {
});
});
});
});

it('Should create an org and a space', () => {
const cardView = cloudFoundry.goToOrgView();

// Click the add button to add an organization
cloudFoundry.header.clickIconButton('add');
const modal = new StepperComponent();
modal.getStepperForm().fill({
'orgname': testOrgName
});
expect(modal.canNext()).toBeTruthy();
modal.next();

cardView.cards.waitUntilShown();

// Go to the org and create a space
cardView.cards.findCardByTitle(testOrgName).then(org => {
org.click();

cloudFoundry.subHeader.clickItem('Spaces');
cardView.cards.waitUntilShown();
const list = new ListComponent();
list.refresh();

// Add space
// Click the add button to add a space
cloudFoundry.header.clickIconButton('add');

modal.getStepperForm().fill({
'spacename': testSpaceName
});
expect(modal.canNext()).toBeTruthy();
modal.next();

cloudFoundry.subHeader.clickItem('Spaces');
cardView.cards.waitUntilShown();
});

});
});