use of com.github.vase4kin.teamcityapp.TeamCityApplication in project TeamCityApp by vase4kin.
the class LoginActivityTest method setUp.
@Before
public void setUp() {
TeamCityApplication app = (TeamCityApplication) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext();
app.getAppInjector().sharedUserStorage().clearAll();
when(mClientBase.newCall(Matchers.any(Request.class))).thenReturn(mCall);
mActivityRule.launchActivity(null);
}
use of com.github.vase4kin.teamcityapp.TeamCityApplication in project TeamCityApp by vase4kin.
the class LoginActivityTest method testUserCanCreateUserAccountWithCorrectUrlAndCredentials.
/**
* Verifies that user can be logged in with correct account url and credentials
*/
@Ignore
@Test
public void testUserCanCreateUserAccountWithCorrectUrlAndCredentials() throws Throwable {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mCallbackArgumentCaptor.getValue().onResponse(mCall, new Response.Builder().request(new Request.Builder().url(URL).build()).protocol(Protocol.HTTP_1_0).code(200).build());
return null;
}
}).when(mCall).enqueue(mCallbackArgumentCaptor.capture());
onView(withId(R.id.teamcity_url)).perform(typeText(INPUT_URL), closeSoftKeyboard());
onView(withId(R.id.user_name)).perform(typeText("user"), pressImeActionButton());
onView(withId(R.id.password)).perform(typeText("pass"), pressImeActionButton());
intended(allOf(hasComponent(RootProjectsActivity.class.getName()), hasExtras(hasEntry(equalTo(BundleExtractorValues.IS_NEW_ACCOUNT_CREATED), equalTo(true)))));
TeamCityApplication app = (TeamCityApplication) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext();
SharedUserStorage storageUtils = app.getRestApiInjector().sharedUserStorage();
assertThat(storageUtils.hasAccountWithUrl(URL, "user"), is(true));
assertThat(storageUtils.getActiveUser().getTeamcityUrl(), is(URL));
}
use of com.github.vase4kin.teamcityapp.TeamCityApplication in project TeamCityApp by vase4kin.
the class LoginActivityTest method testUserCanCreateAccountWithCorrectUrlWhichContainsPathByImeButton.
/**
* Verifies that user can be logged in as guest with correct account url
*/
@Test
public void testUserCanCreateAccountWithCorrectUrlWhichContainsPathByImeButton() throws Throwable {
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
mCallbackArgumentCaptor.getValue().onResponse(mCall, new Response.Builder().request(new Request.Builder().url(URL).build()).protocol(Protocol.HTTP_1_0).message(MESSAGE_EMPTY).code(200).build());
return null;
}
}).when(mCall).enqueue(mCallbackArgumentCaptor.capture());
onView(withId(R.id.guest_user_switch)).perform(click());
onView(withId(R.id.teamcity_url)).perform(typeText(INPUT_URL), pressImeActionButton());
intended(allOf(hasComponent(RootProjectsActivity.class.getName()), hasExtras(hasEntry(equalTo(BundleExtractorValues.IS_NEW_ACCOUNT_CREATED), equalTo(true)))));
TeamCityApplication app = (TeamCityApplication) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext();
SharedUserStorage storageUtils = app.getRestApiInjector().sharedUserStorage();
assertThat(storageUtils.hasGuestAccountWithUrl(URL), is(true));
assertThat(storageUtils.getActiveUser().getTeamcityUrl(), is(URL));
}
use of com.github.vase4kin.teamcityapp.TeamCityApplication in project TeamCityApp by vase4kin.
the class RunBuildActivityTest method setUp.
@Before
public void setUp() {
TeamCityApplication app = (TeamCityApplication) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext();
app.getRestApiInjector().sharedUserStorage().clearAll();
app.getRestApiInjector().sharedUserStorage().saveGuestUserAccountAndSetItAsActive(Mocks.URL);
}
use of com.github.vase4kin.teamcityapp.TeamCityApplication in project TeamCityApp by vase4kin.
the class BuildListActivityTest method setUp.
@Before
public void setUp() {
TeamCityApplication app = (TeamCityApplication) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext();
app.getRestApiInjector().sharedUserStorage().clearAll();
app.getRestApiInjector().sharedUserStorage().saveGuestUserAccountAndSetItAsActive(Mocks.URL);
}
Aggregations