Remove user form org now completely removes the user from the system if the user is orphaned

This commit is contained in:
Torkel Ödegaard
2018-10-11 07:48:35 +02:00
parent 974eddee8f
commit 5b5cb6622d
5 changed files with 73 additions and 39 deletions
+14
View File
@@ -182,6 +182,20 @@ func TestAccountDataAccess(t *testing.T) {
})
})
Convey("Removing user from org should delete user completely if in no other org", func() {
// make sure ac2 has no org
err := DeleteOrg(&m.DeleteOrgCommand{Id: ac2.OrgId})
So(err, ShouldBeNil)
// remove frome ac2 from ac1 org
remCmd := m.RemoveOrgUserCommand{OrgId: ac1.OrgId, UserId: ac2.Id, ShouldDeleteOrphanedUser: true}
err = RemoveOrgUser(&remCmd)
So(err, ShouldBeNil)
err = GetSignedInUser(&m.GetSignedInUserQuery{UserId: ac2.Id})
So(err, ShouldEqual, m.ErrUserNotFound)
})
Convey("Cannot delete last admin org user", func() {
cmd := m.RemoveOrgUserCommand{OrgId: ac1.OrgId, UserId: ac1.Id}
err := RemoveOrgUser(&cmd)