Store nickname and password across screen rotations.

This commit is contained in:
akwizgran
2018-05-11 11:30:57 +01:00
parent e516c329a1
commit e10742a23d
9 changed files with 113 additions and 54 deletions

View File

@@ -73,7 +73,7 @@ public class PasswordFragmentTest {
// assert controller has been called properly
verify(setupController, times(1)).setPassword(safePass);
verify(setupController, times(1)).showDozeOrCreateAccount();
verify(setupController, times(1)).showDozeFragmentOrCreateAccount();
}
@Test

View File

@@ -15,22 +15,8 @@ import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static junit.framework.Assert.assertEquals;
import static org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.NONE;
import static org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.QUITE_STRONG;
import static org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.QUITE_WEAK;
import static org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.STRONG;
import static org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.WEAK;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
import static org.briarproject.bramble.util.StringUtils.getRandomString;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.robolectric.Shadows.shadowOf;
@RunWith(RobolectricTestRunner.class)
@Config(sdk = 21, application = TestBriarApplication.class,

View File

@@ -47,10 +47,17 @@ public class SetupControllerImplTest extends BrambleMockTestCase {
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
public void testCreateAccount() {
context.checking(new Expectations() {{
// Setting the author name shows the password fragment
oneOf(setupActivity).showPasswordFragment();
// Set the author name and password
oneOf(setupActivity).setAuthorName(authorName);
oneOf(setupActivity).setPassword(password);
// Get the author name and password
oneOf(setupActivity).getAuthorName();
will(returnValue(authorName));
oneOf(setupActivity).getPassword();
will(returnValue(password));
// Generate a database key
oneOf(crypto).generateSecretKey();
will(returnValue(key));