Skip to content

Commit

Permalink
remove unnecessary admin user
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyhappydan committed Sep 29, 2023
1 parent 24b60cb commit ee16967
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ object Identity extends TestHelpers {
object userPermissions {
val UserWithNoPermissions = UserCredentials(genString(), genString(), testRealm)
val UserWithPermissions = UserCredentials(genString(), genString(), testRealm)
val AdminUser = UserCredentials(genString(), genString(), testRealm)
}

object archives {
Expand Down Expand Up @@ -100,6 +99,6 @@ object Identity extends TestHelpers {
}

lazy val allUsers =
userPermissions.AdminUser :: userPermissions.UserWithNoPermissions :: userPermissions.UserWithPermissions :: acls.Marge :: archives.Tweety :: compositeviews.Jerry :: events.BugsBunny :: listings.Bob :: listings.Alice :: aggregations.Charlie :: aggregations.Rose :: orgs.Fry :: orgs.Leela :: projects.Bojack :: projects.PrincessCarolyn :: resources.Rick :: resources.Morty :: storages.Coyote :: views.ScoobyDoo :: mash.Radar :: supervision.Mickey :: Nil
userPermissions.UserWithNoPermissions :: userPermissions.UserWithPermissions :: acls.Marge :: archives.Tweety :: compositeviews.Jerry :: events.BugsBunny :: listings.Bob :: listings.Alice :: aggregations.Charlie :: aggregations.Rose :: orgs.Fry :: orgs.Leela :: projects.Bojack :: projects.PrincessCarolyn :: resources.Rick :: resources.Morty :: storages.Coyote :: views.ScoobyDoo :: mash.Radar :: supervision.Mickey :: Nil

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@ package ch.epfl.bluebrain.nexus.tests.iam

import akka.http.scaladsl.model.StatusCodes
import ch.epfl.bluebrain.nexus.delta.kernel.utils.UrlUtils.encode
import ch.epfl.bluebrain.nexus.tests.BaseSpec
import ch.epfl.bluebrain.nexus.tests.Identity.userPermissions.{AdminUser, UserWithNoPermissions, UserWithPermissions}
import ch.epfl.bluebrain.nexus.tests.Identity.userPermissions.{UserWithNoPermissions, UserWithPermissions}
import ch.epfl.bluebrain.nexus.tests.iam.types.Permission
import ch.epfl.bluebrain.nexus.tests.iam.types.Permission.{Organizations, Resources}
import ch.epfl.bluebrain.nexus.tests.iam.types.Permission.Resources
import ch.epfl.bluebrain.nexus.tests.{BaseSpec, Identity}
import io.circe.Json
import org.scalactic.source.Position

class UserPermissionsSpec extends BaseSpec {

val org, project = genId()
val StorageId = "https://bluebrain.github.io/nexus/vocabulary/storage1"
val StorageReadPermission = Permission("s3-storage", "read")
val org, project = genId()
val StorageId = "https://bluebrain.github.io/nexus/vocabulary/storage1"
val StorageReadPermission = Permission("s3-storage", "read")
val StorageWritePermission = Permission("s3-storage", "write")

override def beforeAll(): Unit = {
super.beforeAll()
val result = for {
_ <- permissionDsl.addPermissions(StorageReadPermission, StorageWritePermission)
_ <- aclDsl.addPermission("/", AdminUser, Organizations.Create)
_ <- adminDsl.createOrganization(org, "UserPermissionsSpec organisation", AdminUser)
_ <- adminDsl.createProject(org, project, adminDsl.projectPayload(), AdminUser)
_ <- aclDsl.addPermission("/", AdminUser, Permission.Storages.Write)
_ <- adminDsl.createOrganization(org, "UserPermissionsSpec organisation", Identity.ServiceAccount)
_ <- adminDsl.createProject(org, project, adminDsl.projectPayload(), Identity.ServiceAccount)
_ <- createStorage(StorageId, StorageReadPermission, StorageWritePermission)
} yield succeed

Expand Down Expand Up @@ -91,7 +89,7 @@ class UserPermissionsSpec extends BaseSpec {
"read-permission" -> readPermission.value,
"write-permission" -> writePermission.value
)
deltaClient.post[Json](s"/storages/$org/$project", payload, AdminUser) { (_, response) =>
deltaClient.post[Json](s"/storages/$org/$project", payload, Identity.ServiceAccount) { (_, response) =>
withClue("creation of storage failed: ") {
response.status shouldEqual StatusCodes.Created
}
Expand Down

0 comments on commit ee16967

Please sign in to comment.