Add account creation/deletion unit tests

pull/2/head
Marat Subkhankulov 7 years ago
parent 4884cc57b0
commit 7d2e054ac5
  1. 47
      app/src/androidTest/java/com/wallet/crypto/trustapp/AccountTest.java
  2. 16
      app/src/androidTest/java/com/wallet/crypto/trustapp/ScreengrabTest.java
  3. 4
      app/src/main/java/com/wallet/crypto/trustapp/controller/Controller.java

@ -0,0 +1,47 @@
package com.wallet.crypto.trustapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import com.wallet.crypto.trustapp.controller.Controller;
import com.wallet.crypto.trustapp.model.VMAccount;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class AccountTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
}
@Test
public void deleteAccountTest() {
Controller controller = Controller.get();
VMAccount account = controller.createAccount("test password");
assert(account != null);
try {
controller.deleteAccount(account.getAddress());
} catch (Exception e) {
assert(false);
}
assert(controller.getAccount(account.getAddress()) != null);
}
@Test
public void createAccountTest() {
Controller controller = Controller.get();
VMAccount account = controller.createAccount("test password");
assert(account != null);
}
}

@ -2,20 +2,32 @@ package com.wallet.crypto.trustapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.wallet.crypto.trustapp.views.TransactionListActivity;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
//import tools.fastlane.screengrab.Screengrab;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
public class ScreengrabTest {
@Rule
public ActivityTestRule<TransactionListActivity> activityRule = new ActivityTestRule<>(TransactionListActivity.class);
@Test
public void useAppContext() throws Exception {
public void takeTestScreenshot() throws Exception {
//Screengrab.screenshot("test_screenshot");
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
}

@ -418,10 +418,6 @@ public class Controller {
return "";
}
public void refreshTransactions(TransactionListActivity txnList, OnTaskCompleted listener) {
new GetTransactionsTask(mAccounts, listener).execute();
}
public ESTransaction findTransaction(String address, String txn_hash) {
List<ESTransaction> txns = mTransactions.get(address);

Loading…
Cancel
Save