Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.

stripped issuer from label and updated unit tests #560

Merged
merged 4 commits into from
Jun 10, 2020

Conversation

shivasheeshyadav
Copy link

Fix for issue #551

Issuer is now stripped from the label

Tests are updated accordingly.

Copy link
Member

@flocke flocke left a comment

Choose a reason for hiding this comment

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

The stripping of the label is now ok, but there are still a lot of problems with the tests. I added some comments how I got them to work on my system (they didn't work with just your PR).

app/build.gradle Outdated
@@ -67,4 +68,8 @@ dependencies {
implementation "org.sufficientlysecure:openpgp-api:12.0"
implementation "com.leinardi.android:speed-dial:3.1.1"
implementation "com.mikepenz:aboutlibraries:6.2.3"

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
Copy link
Member

Choose a reason for hiding this comment

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

This is mixing old Android support libraries with the new AndroidX libraries that are used in andOTP and fails for me. You need to use androidTestImplementation "androidx.test.espresso:espresso-core:3.2.0" in order to make it work.

public ApplicationTest() {
super(Application.class);
}
@RunWith(AndroidJUnit4.class)
Copy link
Member

@flocke flocke Jun 9, 2020

Choose a reason for hiding this comment

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

Can be removed, along with the import statements for AndroidJUnit4 and RunWith.

@@ -58,12 +60,13 @@
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

public class ApplicationTest extends ApplicationTestCase<Application> {
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
Copy link
Member

Choose a reason for hiding this comment

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

Use

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

instead.

import android.content.Context;
import android.test.ApplicationTestCase;
import androidx.test.InstrumentationRegistry;
Copy link
Member

Choose a reason for hiding this comment

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

Deprecated, use androidx.test.platform.app.InstrumentationRegistry instead.

public void testSettingsHelper() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException {
Context context = getContext();
Context context = InstrumentationRegistry.getTargetContext();
Copy link
Member

Choose a reason for hiding this comment

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

This is deprecated, use InstrumentationRegistry.getInstrumentation().getTargetContext(); from androidx.test.platform.app.InstrumentationRegistry (see comment above).

@shivasheeshyadav
Copy link
Author

The stripping of the label is now ok, but there are still a lot of problems with the tests. I added some comments how I got them to work on my system (they didn't work with just your PR).

Thanks @flocke
I've fixed the tests as per your suggestions. Please review.

@flocke flocke merged commit 41e398d into andOTP:master Jun 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants