Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/0.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed Mar 15, 2019
2 parents dd72b65 + 32951b8 commit 384d462
Show file tree
Hide file tree
Showing 17 changed files with 358 additions and 79 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ allprojects {
In your application `build.gradle` file, add:

```groovy
def uport_sdk_version = "v0.4.0"
def uport_sdk_version = "v0.4.1"
dependencies {
//...
// core SDK
Expand Down Expand Up @@ -222,6 +222,8 @@ Want to contribute to uport-android-sdk? Cool, please read our [contribution gui


## Changelog
* 0.4.1
* maintenance release

* 0.4.0
* `core` module is a simple java library (and can be used as a dependency in JVM tests)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ buildscript {
khex_version = "0.5"
tweetnacl_k_version = "0.0.1"

uport_sdk_version = "v0.4.0"
uport_sdk_version = "v0.4.1"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package me.uport.sdk.credentials

import org.kethereum.extensions.toHexStringNoPrefix
import org.kethereum.extensions.toHexStringZeroPadded
import java.math.BigInteger

Expand Down
1 change: 1 addition & 0 deletions demoapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dependencies {
androidTestImplementation "com.android.support.test:rules:$test_runner_version"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espresso_version"
androidTestImplementation "io.mockk:mockk-android:$mockk_version"
androidTestImplementation "com.willowtreeapps.assertk:assertk-jvm:$assertk_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class CreateAccountTest {

@Test
fun accountIsCreated() {

Thread.sleep(2000)

onView(withId(R.id.defaultAccountView)).check(matches(withText(not(containsString("ERROR")))))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package me.uport.sdk.demoapp

import android.app.Activity
import android.app.Instrumentation
import android.content.Intent
import android.content.IntentFilter
import android.support.test.InstrumentationRegistry
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.action.ViewActions.click
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.intent.Intents.intending
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction
import android.support.test.espresso.intent.rule.IntentsTestRule
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.test.espresso.matcher.ViewMatchers.withText
import me.uport.sdk.demoapp.request_flows.PersonalSignRequestActivity
import me.uport.sdk.transport.RequestDispatchActivity
import org.hamcrest.CoreMatchers.not
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test

class PersonalSignatureTest {

@get:Rule
val intentsTestRule = IntentsTestRule(PersonalSignRequestActivity::class.java)

private var instrumentation: Instrumentation? = null
private var monitor: Instrumentation.ActivityMonitor? = null
private val filter: IntentFilter? = null

@Before
fun run_before_every_test() {
instrumentation = InstrumentationRegistry.getInstrumentation()
monitor = instrumentation?.addMonitor(filter, null, true)
}

@After
fun run_after_every_test() {
instrumentation?.removeMonitor(monitor)
}

@Before
fun stub_intent() {
// Mock the ActivityResult to be returned to PersonalSignRequestActivity in onActivityResult.
val resultData = Intent()
val redirectUri = "https://uport-project.github.io/uport-android-sdk/callbacks#personalSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1NTI0ODczMjIsImV4cCI6MTU1MjU3MzcyMiwidHlwZSI6InBlcnNvbmFsU2lnblJlc3AiLCJkYXRhIjoiVGhpcyBpcyBhIG1lc3NhZ2UgSSBuZWVkIHlvdSB0byBzaWduIiwic2lnbmF0dXJlIjp7InYiOjI3LCJyIjoiMHgzYjExMmUxMzZiMDI3MDZiNzNjZjhjYjFmNDI0ZDBjZjg1NWExZTM5OTU0ZGM3OTJjZTllYzFmNDkwZmJlZjBiIiwicyI6IjB4N2U0YTViMWU4MWM4YjNjZjJkMTY1ODdjNTUwMjUyNmNjOTM3OWU4OWUwOWI2NTNlMWI2NWUzOThkYzg5MjBjNiJ9LCJpc3MiOiJkaWQ6ZXRocjoweDNmZjI1MTE3YzBlMTcwY2E1MzBiZDU4OTE4OTljMTgzOTQ0ZGI0MzEifQ.5FtBavglhq1aeMtTM644cY5d1ij-0QvlMMLMQhmwVpUtCKOJRBjj3psXrPPuEm28_ZqAV0ISTyH7a2w1osjyzgE"
resultData.putExtra("redirect_uri", redirectUri)
val response = Instrumentation.ActivityResult(Activity.RESULT_OK, resultData)

// This sets up what the ActivityResult to be returned whenever an intent with the below action is launched
intending(hasAction(RequestDispatchActivity.ACTION_DISPATCH_REQUEST)).respondWith(response)
}

@Test
fun data_successfully_signed_by_uport_account() {

// User clicks on send request.
onView(withId(R.id.send_request)).perform(click())

Thread.sleep(5000)

// Response detail TextView will no longer be empty
onView(withId(R.id.response_details)).check(matches(not(withText(""))))
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package me.uport.sdk.demoapp

import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.action.ViewActions.click
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.test.rule.ActivityTestRule
import assertk.assert
import assertk.assertions.isNotEqualTo
Expand All @@ -16,10 +13,10 @@ class SignJWTUportHDTest {
val activityRule = ActivityTestRule(SignJWTUportHDSignerActivity::class.java)

@Test
fun keyIsCreated() {
fun signerIsCreated() {

onView(withId(R.id.submit_btn_one)).perform(click())
Thread.sleep(1000)

assert(activityRule.activity.issuerDID).isNotEqualTo("null")
assert(activityRule.activity.issuerDID).isNotEqualTo("")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package me.uport.sdk.demoapp

import android.app.Activity
import android.app.Instrumentation
import android.content.Intent
import android.content.IntentFilter
import android.support.test.InstrumentationRegistry
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.action.ViewActions.click
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.intent.Intents.intending
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction
import android.support.test.espresso.intent.rule.IntentsTestRule
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.test.espresso.matcher.ViewMatchers.withText
import me.uport.sdk.demoapp.request_flows.EthereumTransactionActivity
import me.uport.sdk.transport.RequestDispatchActivity
import org.hamcrest.CoreMatchers.not
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test

class TransactionRequestTest {

@get:Rule
val intentsTestRule = IntentsTestRule(EthereumTransactionActivity::class.java)

private var instrumentation: Instrumentation? = null
private var monitor: Instrumentation.ActivityMonitor? = null
private val filter: IntentFilter? = null

@Before
fun run_before_every_test() {
instrumentation = InstrumentationRegistry.getInstrumentation()
monitor = instrumentation?.addMonitor(filter, null, true)
}

@After
fun run_after_every_test() {
instrumentation?.removeMonitor(monitor)
}

@Before
fun stub_intent() {
// Mock the ActivityResult to be returned to EthereumTransactionActivity in onActivityResult.
val resultData = Intent()
val redirectUri = "https://uport-project.github.io/uport-android-sdk/callbacks#tx=6146ccf6a66d994f7c363db875e31ca35581450a4bf6d3be6cc9ac79233a69d0"
resultData.putExtra("redirect_uri", redirectUri)
val response = Instrumentation.ActivityResult(Activity.RESULT_OK, resultData)

// This sets up what the ActivityResult to be returned whenever an intent with the below action is launched
intending(hasAction(RequestDispatchActivity.ACTION_DISPATCH_REQUEST)).respondWith(response)
}

@Test
fun transaction_request_successfully_approved_by_uport_account() {
// User clicks on send request.
onView(withId(R.id.send_request)).perform(click())

Thread.sleep(5000)

// Response detail TextView will no longer be empty
onView(withId(R.id.response_details)).check(matches(not(withText(""))))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package me.uport.sdk.demoapp

import android.app.Activity
import android.app.Instrumentation
import android.content.Intent
import android.content.IntentFilter
import android.support.test.InstrumentationRegistry
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.action.ViewActions.click
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.intent.Intents.intending
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction
import android.support.test.espresso.intent.rule.IntentsTestRule
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.test.espresso.matcher.ViewMatchers.withText
import me.uport.sdk.demoapp.request_flows.TypedDataRequestActivity
import me.uport.sdk.transport.RequestDispatchActivity
import org.hamcrest.CoreMatchers.not
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test

class TypedDataTests {

@get:Rule
val intentsTestRule = IntentsTestRule(TypedDataRequestActivity::class.java)

private var instrumentation: Instrumentation? = null
private var monitor: Instrumentation.ActivityMonitor? = null
private val filter: IntentFilter? = null

@Before
fun run_before_every_test() {
instrumentation = InstrumentationRegistry.getInstrumentation()
monitor = instrumentation?.addMonitor(filter, null, true)
}

@After
fun run_after_every_test() {
instrumentation?.removeMonitor(monitor)
}

@Before
fun stub_intent() {
// Mock the ActivityResult to be returned to TypedDataRequestActivity in onActivityResult.
val resultData = Intent()
val redirectUri = "https://uport-project.github.io/uport-android-sdk/callbacks#typedDataSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1NTI0ODk1NDEsImV4cCI6MTU1MjU3NTk0MSwidHlwZSI6ImVpcDcxMlJlc3AiLCJyZXF1ZXN0Ijp7InR5cGVzIjp7IkVJUDcxMkRvbWFpbiI6W3sibmFtZSI6Im5hbWUiLCJ0eXBlIjoic3RyaW5nIn0seyJuYW1lIjoidmVyc2lvbiIsInR5cGUiOiJzdHJpbmcifSx7Im5hbWUiOiJjaGFpbklkIiwidHlwZSI6InVpbnQyNTYifSx7Im5hbWUiOiJ2ZXJpZnlpbmdDb250cmFjdCIsInR5cGUiOiJhZGRyZXNzIn1dLCJQZXJzb24iOlt7Im5hb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rc7wE"
resultData.putExtra("redirect_uri", redirectUri)
val response = Instrumentation.ActivityResult(Activity.RESULT_OK, resultData)

// This sets up what the ActivityResult to be returned whenever an intent with the below action is launched
intending(hasAction(RequestDispatchActivity.ACTION_DISPATCH_REQUEST)).respondWith(response)
}

@Test
fun typed_data_successfully_signed_by_uport_account() {

// User clicks on send request.
onView(withId(R.id.send_request)).perform(click())

Thread.sleep(5000)

// Response detail TextView will no longer be empty
onView(withId(R.id.response_details)).check(matches(not(withText(""))))
}
}
Loading

0 comments on commit 384d462

Please sign in to comment.