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

[DIA-2757] UI test for the applies condition #714

Merged
merged 8 commits into from
Oct 23, 2023

Conversation

carmelo-iriti
Copy link
Contributor

No description provided.

@carmelo-iriti carmelo-iriti marked this pull request as draft October 18, 2023 07:13
@carmelo-iriti carmelo-iriti changed the title [DIA-2757} UI test for the applies condition [DIA-2757] UI test for the applies condition Oct 18, 2023
@carmelo-iriti carmelo-iriti marked this pull request as ready for review October 18, 2023 13:38
@SerialName("GPPData") @Serializable(with = JsonMapSerializer::class) val gppData: Map<String, JsonElement>? = null,
@SerialName("uuid") var uuid: String?,
@SerialName("webConsentPayload") val webConsentPayload: JsonObject? = null,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my pov, the thing that you refactored here looked more readable and it followed KCS, but it might be the matter of taste here, so I'm ok with that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go ahead and remove the annotations all together, keeping only the ones that are strictly necessary (those whose attribute name differ from the api response).

@bohdan-go-wombat thanks for sharing the KCS link, it seems that annotations without arguments are allowed to be in the same line as the example:

@Test fun foo() { /*...*/ }


internal fun getConnectionManager(appCtx: Context): ConnectionManager = ConnectionManager.create(appCtx)

internal fun networkClient(appCtx: Context, netClient: OkHttpClient, responseManage: ResponseManager, logger: Logger): NetworkClient {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need and instance of Context here, since we don't use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because using the variants technique, we must have the signature of the method the same in all files (the contents can be different)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha

@@ -31,6 +31,7 @@ internal fun CcpaCS.toCCPAConsentInternal(): CCPAConsentInternal {
thisContent = JSONObject(),
signedLspa = signedLspa,
webConsentPayload = webConsentPayload,
uspstring = this.uspstring ?: "1YNN"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use constant here, instead of hardcoded value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@@ -131,26 +131,25 @@ internal fun MessagesParamReq.toConsentStatusParamReq(
)
}

internal fun CCPA.toCcpaCS() = CcpaCS(
internal fun CCPA.toCcpaCS(applies: Boolean?) = CcpaCS(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now I'm thinking, wouldn't it be better for us not to update applies value anywhere, except from the response of the /meta-data call? that will ease-out this flow, so that we don't need to pass an extra value into the ext function, and we will not worry about the value of applies having wrong value

wdyt?

Copy link
Contributor Author

@carmelo-iriti carmelo-iriti Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set applies as a parameter in order to make it explicit, in this function we are converting one type into another and this parameter force us to check what we are sending and also to use the applies value from the single source of truth which is the meta-data call.
In this way we are sure to avoid the inconsistency of the data that Chris was writing in more that one ticket

Copy link
Collaborator

@bohdan-go-wombat bohdan-go-wombat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple of questions, after we sort those out I can approve

@SerialName("GPPData") @Serializable(with = JsonMapSerializer::class) val gppData: Map<String, JsonElement>? = null,
@SerialName("uuid") var uuid: String?,
@SerialName("webConsentPayload") val webConsentPayload: JsonObject? = null,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go ahead and remove the annotations all together, keeping only the ones that are strictly necessary (those whose attribute name differ from the api response).

@bohdan-go-wombat thanks for sharing the KCS link, it seems that annotations without arguments are allowed to be in the same line as the example:

@Test fun foo() { /*...*/ }

"$specificationVersion$opportunityToOptOut$optOutSale$lspaCoveredTransaction"
} else DEFAULT_CCPA_USP_STRING
val usPString = "$specificationVersion$opportunityToOptOut$optOutSale$lspaCoveredTransaction"
logger?.computation(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carmelo-iriti these loggers are really getting on the way of readability. Can we get rid of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no, because I use them to check if the conditions are matched and in production they are not logging anything (using the veriants technique)

@andresilveirah
Copy link
Member

@carmelo-iriti I believe this PR should have been broken down. The title says UI tests for applies condition, but I see changes for the usp string, logic changes, tests and code styling changes all in the same group.

@carmelo-iriti
Copy link
Contributor Author

@andresilveirah this is the original code styling which was changed in some pr

@carmelo-iriti
Copy link
Contributor Author

@andresilveirah the changes for the uspstring have to stay in order to make the tests working

@andresilveirah
Copy link
Member

@andresilveirah this is the original code styling which was changed in some pr

Agree. Many things were changed in the previous PRs. And they were changed for a reason. I suggest we keep things the way they are unless there's a strong argument against it.

@carmelo-iriti
Copy link
Contributor Author

@andresilveirah originally I chose the standard code style for kotlin where the annotations are in line with the variable different than java where every time you have a new line

@andresilveirah
Copy link
Member

@carmelo-iriti understood, thanks for the info. Do you mind reverting back the styling changes just so we can focus on the actual changes in this PR? If necessary, we can address code styling changes in a separate PR only for that.

@carmelo-iriti
Copy link
Contributor Author

@andresilveirah ok

@cmaurersp
Copy link

The one issue I saw with the applies value is when you click on the Save & Close button in the privacy manager the onConsentReady and onSpFinish. This issue was submitted on https://sourcepoint.atlassian.net/browse/DIA-2901

@cmaurersp
Copy link

The consent.ccpa?.consents?.uspstring and the consent.ccpa?.consents?.applies were aligned in my tests

@carmelo-iriti
Copy link
Contributor Author

@cmaurersp Thanks, I skipped the UI test for the gdpr PM 👍🏻

@carmelo-iriti carmelo-iriti merged commit e086c52 into develop Oct 23, 2023
4 checks passed
@andresilveirah andresilveirah deleted the dia-2757-UI-test-2198 branch April 22, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants