mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:56:46 +00:00
set the custom public view as _public as the default -- fixed the tests
This commit is contained in:
parent
57a96d0868
commit
ddbee49d8c
@ -17,6 +17,7 @@ object Constant extends MdcLoggable {
|
||||
//eg: one account, already have the owner view with bankId and accountId, so we keep it. actually it is a custom view,
|
||||
// but there is no underscore there.
|
||||
//But for new accounts, we only allow to create with with under score, and all the accounts will share the same System Views.
|
||||
final val CUSTOM_PUBLIC_VIEW_ID = "_public"
|
||||
final val CUSTOM_OWNER_VIEW_ID = "owner"
|
||||
final val SYSTEM_OWNER_VIEW_ID = "owner"
|
||||
final val SYSTEM_AUDITOR_VIEW_ID = "auditor"
|
||||
|
||||
@ -546,7 +546,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
}
|
||||
|
||||
def getOrCreatePublicView(bankId: BankId, accountId: AccountId, description: String = "Public View") : Box[View] = {
|
||||
getExistingView(bankId, accountId, "public") match {
|
||||
getExistingView(bankId, accountId, CUSTOM_PUBLIC_VIEW_ID) match {
|
||||
case Empty=> createDefaultPublicView(bankId, accountId, description)
|
||||
case Full(v)=> Full(v)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
@ -1009,9 +1009,9 @@ object MapperViews extends Views with MdcLoggable {
|
||||
val entity = create.
|
||||
isSystem_(false).
|
||||
isFirehose_(true). // This View is public so it might as well be firehose too.
|
||||
name_("Public").
|
||||
name_("_Public").
|
||||
description_(description).
|
||||
view_id("public").
|
||||
view_id(CUSTOM_PUBLIC_VIEW_ID). //public is only for custom views
|
||||
isPublic_(true).
|
||||
bank_id(bankId.value).
|
||||
account_id(accountId.value).
|
||||
|
||||
@ -5252,7 +5252,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token and will set a comment first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = "public"
|
||||
val view = CUSTOM_PUBLIC_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomComment = PostTransactionCommentJSON(randomString(20))
|
||||
val postedReply = postCommentForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomComment, user2)
|
||||
@ -5593,7 +5593,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token and will set a tag first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = "public"
|
||||
val view = CUSTOM_PUBLIC_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomTag = PostTransactionTagJSON(randomString(5))
|
||||
val postedReply = postTagForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomTag, user2)
|
||||
@ -5933,7 +5933,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token and will set an image first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = "public"
|
||||
val view = CUSTOM_PUBLIC_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomImage = PostTransactionImageJSON(randomString(5),"http://www.mysuperimage.com")
|
||||
val postedReply = postImageForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomImage, user1)
|
||||
@ -6351,7 +6351,7 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
Given("We will use an access token and will set a where tag first")
|
||||
val bankId = randomBank
|
||||
val bankAccount : AccountJSON = randomPrivateAccount(bankId)
|
||||
val view = "public"
|
||||
val view = CUSTOM_PUBLIC_VIEW_ID
|
||||
val transaction = randomTransaction(bankId, bankAccount.id, view)
|
||||
val randomLoc = randomLocation
|
||||
postWhereForOneTransaction(bankId, bankAccount.id, view, transaction.id, randomLoc, user1)
|
||||
|
||||
@ -50,11 +50,11 @@ class AuthUserTest extends ServerSetup with DefaultUsers {
|
||||
val allViewsForAccount2 = MapperViews.assignedViewsForAccount(bankIdAccountId)
|
||||
val allViews = ViewDefinition.findAll()
|
||||
allViewsForAccount1.toString().contains("owner") should equal(true)
|
||||
allViewsForAccount1.toString().contains("public") should equal(true)
|
||||
allViewsForAccount1.toString().contains("_public") should equal(true)
|
||||
allViewsForAccount1.toString().contains("accountant") should equal(true)
|
||||
allViewsForAccount1.toString().contains("auditor") should equal(true)
|
||||
allViewsForAccount2.toString().contains("owner") should equal(true)
|
||||
allViewsForAccount2.toString().contains("public") should equal(true)
|
||||
allViewsForAccount2.toString().contains("_public") should equal(true)
|
||||
allViewsForAccount2.toString().contains("accountant") should equal(true)
|
||||
allViewsForAccount2.toString().contains("auditor") should equal(true)
|
||||
allViews.length should equal(8)
|
||||
|
||||
@ -21,7 +21,7 @@ class MappedViewsTest extends ServerSetup with DefaultUsers{
|
||||
val bankIdAccountId = BankIdAccountId(BankId("1"),AccountId("2"))
|
||||
|
||||
val viewIdOwner = "owner"
|
||||
val viewIdPublic = "public"
|
||||
val viewIdPublic = "_public"
|
||||
val viewIdAccountant = "accountant"
|
||||
val viewIdAuditor = "auditor"
|
||||
val viewIdNotSupport = "NotSupport"
|
||||
@ -40,7 +40,7 @@ class MappedViewsTest extends ServerSetup with DefaultUsers{
|
||||
|
||||
Then("Check the result from database. it should have 4 views and with the right viewId")
|
||||
viewOwner.head.viewId.value should equal("owner".toLowerCase())
|
||||
viewPublic.head.viewId.value should equal("public".toLowerCase())
|
||||
viewPublic.head.viewId.value should equal("_public".toLowerCase())
|
||||
viewAccountant.head.viewId.value should equal("accountant".toLowerCase())
|
||||
viewAuditor.head.viewId.value should equal("auditor".toLowerCase())
|
||||
allExistingViewsForOneAccount.length should equal(4)
|
||||
@ -54,7 +54,7 @@ class MappedViewsTest extends ServerSetup with DefaultUsers{
|
||||
|
||||
Then("Check the result from database again. it should have four views and with the right viewId, there should be not changed.")
|
||||
viewOwner.head.viewId.value should equal("owner".toLowerCase())
|
||||
viewPublic.head.viewId.value should equal("public".toLowerCase())
|
||||
viewPublic.head.viewId.value should equal("_public".toLowerCase())
|
||||
viewAccountant.head.viewId.value should equal("accountant".toLowerCase())
|
||||
viewAuditor.head.viewId.value should equal("auditor".toLowerCase())
|
||||
allExistingViewsForOneAccount.length should equal(4)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user