本文整理了Java中com.zulip.android.ZulipApp.getApiKey()
方法的一些代码示例,展示了ZulipApp.getApiKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZulipApp.getApiKey()
方法的具体详情如下:
包路径:com.zulip.android.ZulipApp
类名称:ZulipApp
方法名:getApiKey
暂无
代码示例来源:origin: zulip/zulip-android
@Override
public Response intercept(Chain chain) throws IOException {
Request.Builder requestBuilder = chain.request().newBuilder();
requestBuilder.addHeader("client", "Android");
requestBuilder.addHeader("User-Agent", app.getUserAgent());
if (app.getApiKey() != null) {
String authstr = app.getEmail() + ":" + app.getApiKey();
requestBuilder.addHeader("Authorization", "Basic " + Base64.encodeToString(authstr.getBytes(), Base64.NO_WRAP));
}
Request request = requestBuilder.build();
return chain.proceed(request);
}
}
代码示例来源:origin: zulip/zulip-android
if (this.app.getApiKey() != null) {
String authstr = this.app.getEmail() + ":" + this.app.getApiKey();
requestBuilder.addHeader("Authorization", "Basic " + Base64.encodeToString(authstr.getBytes(), Base64.NO_WRAP));
代码示例来源:origin: zulip/zulip-android
if (ZulipApp.get().getApiKey() == null || ZulipApp.get().getApiKey().isEmpty()) {
Toast.makeText(this, R.string.no_login_error_widget, Toast.LENGTH_SHORT).show();
finish();
代码示例来源:origin: zulip/zulip-android
@Before
public void setUp() {
if (ZulipApp.get().getApiKey() != null) {
logout();
}
}
代码示例来源:origin: zulip/zulip-android
@Test
public void TestSerially() {
if (!ZulipApp.get().getApiKey().isEmpty()) {
BaseTest baseTest = new BaseTest();
baseTest.logout();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
ZLog.logException(e);
}
}
getDevEmails();
loginThroughDevMail();
}
代码示例来源:origin: zulip/zulip-android
@Test
public void logout() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
ZLog.logException(e);
}
mActivityTestRule.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
mActivityTestRule.getActivity().showView(mActivityTestRule.getActivity().findViewById(R.id.appBarLayout));
}
});
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
ZLog.logException(e);
}
//Open overflow menu
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
//Click Logout Button
onView(withText(R.string.logout)).perform(click());
//Check API Key for verifying
assertNull(ZulipApp.get().getApiKey());
}
代码示例来源:origin: zulip/zulip-android
@Before
public void setUp() {
app = ZulipApp.get();
if (ZulipApp.get().getApiKey() == null) {
BaseTest baseTest = new BaseTest();
baseTest.login();
sleep(4000);
}
//This is to make sure the latest recieved messages will be added to the list!
app.setPointer(app.getMaxMessageId());
setTestMessageStream((testMessageStream == null) ? RandomStringUtils.randomAlphanumeric(10) : testMessageStream);
setTestMessagePrivate((testMessagePrivate == null) ? RandomStringUtils.randomAlphanumeric(15) : testMessagePrivate);
}
代码示例来源:origin: zulip/zulip-android
@Test
public void WrongLoginPasswordToast() {
if (ZulipApp.get().getApiKey() != null) {
logout();
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
ZLog.logException(e);
}
}
//Fill Server URL
ViewInteraction serverURLInteraction = onView(allOf(withId(R.id.server_url_in), isDisplayed()));
serverURLInteraction.perform(replaceText(SERVER_URL));
//Click Enter server URL
ViewInteraction enterServerUrl = onView(allOf(withId(R.id.server_btn), withText(R.string.enter), isDisplayed()));
enterServerUrl.perform(click());
//Fill Username
ViewInteraction usernameVI = onView(
allOf(withId(R.id.username), isDisplayed()));
usernameVI.perform(replaceText(EMAIL_TEST));
//Fill Password
ViewInteraction passwordVI = onView(
allOf(withId(R.id.password), isDisplayed()));
passwordVI.perform(replaceText("WRONG_PASSWORD"));
//Click Login
ViewInteraction button = onView(
allOf(withId(R.id.zulip_login), withText("Log in"), isDisplayed()));
button.perform(click());
onView(withText("Your username or password is incorrect.")).inRoot(isToast()).check(matches(isDisplayed()));
}
内容来源于网络,如有侵权,请联系作者删除!