use of org.edx.mobile.user.Account in project edx-app-android by edx.
the class UserProfileInteractorTest method onAccountUpdatedEvent_withUnrelatedUsername_emitsUpdatedProfileContent.
@Test
public void onAccountUpdatedEvent_withUnrelatedUsername_emitsUpdatedProfileContent() throws Exception {
final Account account = configureBareMockAccount();
createAndObserveInteractor();
verify(profileObserver).onData(refEq(new UserProfileViewModel(UserProfileViewModel.LimitedProfileMessage.NONE, null, null, new UserProfileBioModel(UserProfileBioModel.ContentType.NO_ABOUT_ME, null))));
when(account.getUsername()).thenReturn(ProfileValues.ALTERNATE_USERNAME);
when(account.getBio()).thenReturn(ProfileValues.ABOUT_ME);
eventBus.post(new AccountDataLoadedEvent(account));
verifyNoMoreInteractions(profileObserver);
}
use of org.edx.mobile.user.Account in project edx-app-android by edx.
the class UserProfileInteractorTest method whenProfileObserved_withParentalConsentRequired_asUserBeingViewed_emitsParentalConsentRequired.
@Test
public void whenProfileObserved_withParentalConsentRequired_asUserBeingViewed_emitsParentalConsentRequired() {
setAuthenticatedUsername(ProfileValues.USERNAME);
final Account account = configureBareMockAccount();
when(account.requiresParentalConsent()).thenReturn(true);
createAndObserveInteractor();
verify(profileObserver).onData(refEq(new UserProfileViewModel(UserProfileViewModel.LimitedProfileMessage.OWN_PROFILE, null, null, new UserProfileBioModel(UserProfileBioModel.ContentType.PARENTAL_CONSENT_REQUIRED, null))));
}
use of org.edx.mobile.user.Account in project edx-app-android by edx.
the class UserProfileInteractorTest method whenProfileObserved_withInvalidCountryCode_emitsProfileWithNoCountry.
@Test
public void whenProfileObserved_withInvalidCountryCode_emitsProfileWithNoCountry() {
final Account account = configureBareMockAccount();
when(account.getCountry()).thenReturn(ProfileValues.INVALID_COUNTRY_CODE);
createAndObserveInteractor();
verify(profileObserver).onData(refEq(new UserProfileViewModel(UserProfileViewModel.LimitedProfileMessage.NONE, null, null, new UserProfileBioModel(UserProfileBioModel.ContentType.NO_ABOUT_ME, null))));
}
use of org.edx.mobile.user.Account in project edx-app-android by edx.
the class UserProfileInteractorTest method whenProfileObserved_withFullProfile_emitsLanguageAndLocationAndAboutMe.
@Test
public void whenProfileObserved_withFullProfile_emitsLanguageAndLocationAndAboutMe() {
final Account account = configureBareMockAccount();
when(account.getBio()).thenReturn(ProfileValues.ABOUT_ME);
when(account.getCountry()).thenReturn(ProfileValues.COUNTRY_CODE);
when(account.getLanguageProficiencies()).thenReturn(Collections.singletonList(new LanguageProficiency(ProfileValues.LANGUAGE_CODE)));
createAndObserveInteractor();
verify(profileObserver).onData(refEq(new UserProfileViewModel(UserProfileViewModel.LimitedProfileMessage.NONE, ProfileValues.LANGUAGE_NAME, ProfileValues.COUNTRY_NAME, new UserProfileBioModel(UserProfileBioModel.ContentType.ABOUT_ME, ProfileValues.ABOUT_ME))));
}
use of org.edx.mobile.user.Account in project edx-app-android by edx.
the class UserProfileInteractorTest method whenProfileObserved_withNoAboutMe_withPrivateAccount_asUserBeingViewed_emitsIncompleteProfileMessageAndContent.
@Test
public void whenProfileObserved_withNoAboutMe_withPrivateAccount_asUserBeingViewed_emitsIncompleteProfileMessageAndContent() throws Exception {
setAuthenticatedUsername(ProfileValues.USERNAME);
final Account account = configureBareMockAccount();
when(account.getAccountPrivacy()).thenReturn(Account.Privacy.PRIVATE);
createAndObserveInteractor();
verify(profileObserver).onData(refEq(new UserProfileViewModel(UserProfileViewModel.LimitedProfileMessage.OWN_PROFILE, null, null, new UserProfileBioModel(UserProfileBioModel.ContentType.INCOMPLETE, null))));
}
Aggregations