2016-12-07 18:38:59 +01:00
|
|
|
set_global("page_params", {
|
|
|
|
realm_uri: "https://chat.example.com",
|
|
|
|
});
|
|
|
|
|
2017-04-06 22:47:27 +02:00
|
|
|
var settings_bots = require("js/settings_bots.js");
|
2016-12-07 18:38:59 +01:00
|
|
|
|
|
|
|
(function test_generate_zuliprc_uri() {
|
|
|
|
var bot = {
|
|
|
|
email: "error-bot@zulip.org",
|
|
|
|
api_key: "QadL788EkiottHmukyhHgePUFHREiu8b",
|
|
|
|
};
|
2017-04-06 22:47:27 +02:00
|
|
|
var uri = settings_bots.generate_zuliprc_uri(bot.email, bot.api_key);
|
2016-12-07 18:38:59 +01:00
|
|
|
var expected = "data:application/octet-stream;charset=utf-8," + encodeURIComponent(
|
|
|
|
"[api]\nemail=error-bot@zulip.org\n" +
|
|
|
|
"key=QadL788EkiottHmukyhHgePUFHREiu8b\n" +
|
|
|
|
"site=https://chat.example.com\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(uri, expected);
|
|
|
|
}());
|
|
|
|
|
|
|
|
(function test_generate_zuliprc_content() {
|
|
|
|
var user = {
|
|
|
|
email: "admin12@chatting.net",
|
2017-01-12 00:17:43 +01:00
|
|
|
api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34",
|
2016-12-07 18:38:59 +01:00
|
|
|
};
|
2017-04-06 22:47:27 +02:00
|
|
|
var content = settings_bots.generate_zuliprc_content(user.email, user.api_key);
|
2016-12-07 18:38:59 +01:00
|
|
|
var expected = "[api]\nemail=admin12@chatting.net\n" +
|
|
|
|
"key=nSlA0mUm7G42LP85lMv7syqFTzDE2q34\n" +
|
|
|
|
"site=https://chat.example.com\n";
|
|
|
|
|
|
|
|
assert.equal(content, expected);
|
|
|
|
}());
|