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

zios-9245 remove keychain testing logic which prevent deleting items #72

Merged
merged 10 commits into from Jan 2, 2018

Conversation

billypchan
Copy link
Contributor

What's new in this PR?

Issues

In ZMPersistentCookieStorage.deleteKeychainItems() method, keychain items may not be deleted if KeychainDisabled is set to true.

Causes

KeychainDisabled is enabled for when running tests only, which would not be used in the release. The test-only logic was not separated from the main logic.

Solutions

Remove KeychainDisabled check in ZMPersistentCookieStorage.deleteKeychainItems() (It is tested and would not affect the tests)
Move + (void)setDoNotPersistToKeychain:(BOOL)disabled to private header to confirm that it can only be used in tests.

Discussion

It would be better create a mock of ZMPersistentCookieStorage for running unit tests.

@billypchan billypchan changed the title zios-9245 remove keychain testing login which prevent deleting items zios-9245 remove keychain testing logic which prevent deleting items Jan 2, 2018
@@ -0,0 +1,23 @@
////
// Wire
// Copyright (C) 2017 Wire Swiss GmbH
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Your copyright header is so last year!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was created last year!

@wire-bot
Copy link
Contributor

wire-bot commented Jan 2, 2018

3 Warnings
⚠️ Source/Authentication/ZMPersistentCookieStorage.m#L1 - Copyright header is missing or in wrong format
⚠️ Source/Public/ZMPersistentCookieStorage.h#L1 - Copyright header is missing or in wrong format
⚠️ Tests/Source/Authentication/ZMAccessTokenHandlerTests.m#L1 - Copyright header is missing or in wrong format

Generated by 🚫 Danger

@codecov-io
Copy link

codecov-io commented Jan 2, 2018

Codecov Report

Merging #72 into develop will increase coverage by 0.87%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #72      +/-   ##
===========================================
+ Coverage    74.81%   75.68%   +0.87%     
===========================================
  Files           42       42              
  Lines         3724     3722       -2     
===========================================
+ Hits          2786     2817      +31     
+ Misses         938      905      -33
Impacted Files Coverage Δ
Source/Authentication/ZMPersistentCookieStorage.m 78.1% <ø> (+0.91%) ⬆️
Source/Authentication/ZMKeychain.m 24.8% <0%> (+24.8%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42f40ff...ff9a91b. Read the comment docs.

@@ -0,0 +1,6 @@
explicit module WireTransport.Private {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice solution to this problem!
We could also solve the issue with Swift interoperability - some of the ObjC classes have public and private headers. In Swift we can only access things in private header which makes it hard to extend ObjC classes in Swift because we need to have access to the same things as any other ObjC class.

The only thing that we should do here is to rename the module to WireTransport.Testing because this is not really private but test code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, we should use it in other places too.

@@ -678,6 +682,7 @@
54CA14FF1B32F2C1008D3787 /* ZMAccessToken.m */,
54CA15001B32F2C1008D3787 /* ZMAccessTokenHandler.h */,
54CA15011B32F2C1008D3787 /* ZMAccessTokenHandler.m */,
EF1A09A31FF6A73200F89634 /* ZMPersistentCookieStorage+Private.h */,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same could be for the filename

@@ -0,0 +1,29 @@
////
// Wire
// Copyright (C) 2017 Wire Swiss GmbH
Copy link
Contributor

@wire-bot wire-bot Jan 2, 2018

Choose a reason for hiding this comment

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

⚠️ Your copyright header is so last year!

@@ -460,6 +463,7 @@
3E88BC9D1B1F35DF00232589 = {
isa = PBXGroup;
children = (
EF1A09A51FF6BEE300F89634 /* private.modulemap */,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to bother you again, but this still has the old name :)

@billypchan billypchan merged commit 9f93e6b into develop Jan 2, 2018
@billypchan billypchan deleted the fix/ZIOS-9245-keychain-disable branch January 2, 2018 13:35
zenkins added a commit that referenced this pull request Jan 2, 2018
Diff with previous:
30.1.0...30.2.0

Commits:
	9f93e6b zios-9245 remove keychain testing logic which prevent deleting items (#72)
@billypchan billypchan restored the fix/ZIOS-9245-keychain-disable branch January 2, 2018 14:17
@alexisakers alexisakers deleted the fix/ZIOS-9245-keychain-disable branch February 1, 2019 15:08
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.

None yet

5 participants