Update anonymous tests

This commit is contained in:
xbgmsharp
2024-01-17 20:24:58 +01:00
parent d3dd46c834
commit 288c458c5a
2 changed files with 43 additions and 2 deletions

View File

@@ -50,6 +50,24 @@ var moment = require("moment");
payload: null, payload: null,
res: {}, res: {},
}, },
timelapse_full: {
url: "/rpc/timelapse_fn",
header: { name: "x-is-public", value: btoa("kapla,public_timelapse,0") },
payload: null,
res: {},
},
stats_logs: {
url: "/rpc/stats_logs_fn",
header: { name: "x-is-public", value: btoa("kapla,public_stats,0") },
payload: null,
res: {},
},
stats_stays: {
url: "/rpc/stats_stay_fn",
header: { name: "x-is-public", value: btoa("kapla,public_stats,0") },
payload: null,
res: {},
},
export_gpx: { export_gpx: {
url: "/rpc/export_logbook_gpx_fn", url: "/rpc/export_logbook_gpx_fn",
header: { name: "x-is-public", value: btoa("kapla,public_logs,0") }, header: { name: "x-is-public", value: btoa("kapla,public_logs,0") },
@@ -79,11 +97,29 @@ var moment = require("moment");
res: {}, res: {},
}, },
timelapse: { timelapse: {
url: "/rpc/timelapse_fn",
header: { name: "x-is-public", value: btoa("aava,public_timelapse,3") },
payload: null,
res: {},
},
timelapse_full: {
url: "/rpc/timelapse_fn", url: "/rpc/timelapse_fn",
header: { name: "x-is-public", value: btoa("aava,public_timelapse,0") }, header: { name: "x-is-public", value: btoa("aava,public_timelapse,0") },
payload: null, payload: null,
res: {}, res: {},
}, },
stats_logs: {
url: "/rpc/stats_logs_fn",
header: { name: "x-is-public", value: btoa("aava,public_stats,0") },
payload: null,
res: {},
},
stats_stays: {
url: "/rpc/stats_stay_fn",
header: { name: "x-is-public", value: btoa("kapla,public_stats,0") },
payload: null,
res: {},
},
export_gpx: { export_gpx: {
url: "/rpc/export_logbook_gpx_fn", url: "/rpc/export_logbook_gpx_fn",
header: { name: "x-is-public", value: btoa("aava,public_logs,0") }, header: { name: "x-is-public", value: btoa("aava,public_logs,0") },
@@ -97,7 +133,7 @@ var moment = require("moment");
request = supertest.agent(test.cname); request = supertest.agent(test.cname);
request.set("User-Agent", "PostgSail unit tests"); request.set("User-Agent", "PostgSail unit tests");
describe("Get JWT api_anonymous", function () { describe("With no JWT as api_anonymous", function () {
it("/logs_view, api_anonymous no jwt token", function (done) { it("/logs_view, api_anonymous no jwt token", function (done) {
// Reset agent so we do not save cookies // Reset agent so we do not save cookies
request = supertest.agent(test.cname); request = supertest.agent(test.cname);
@@ -156,7 +192,7 @@ var moment = require("moment");
.set("Accept", "application/json") .set("Accept", "application/json")
.end(function (err, res) { .end(function (err, res) {
console.log(res.text); console.log(res.text);
res.status.should.equal(404); res.status.should.equal(404); // return 404 as it is not enable in user settings.
should.exist(res.header["content-type"]); should.exist(res.header["content-type"]);
should.exist(res.header["server"]); should.exist(res.header["server"]);
res.header["content-type"].should.match(new RegExp("json", "g")); res.header["content-type"].should.match(new RegExp("json", "g"));

View File

@@ -69,3 +69,8 @@ SELECT extra FROM api.logbook l WHERE id = 1 AND vessel_id = current_setting('ve
--SELECT api.export_logbook_geojson_fn(1); --SELECT api.export_logbook_geojson_fn(1);
--SELECT api.export_logbook_gpx_fn(1); --SELECT api.export_logbook_gpx_fn(1);
--SELECT api.export_logbook_kml_fn(1); --SELECT api.export_logbook_kml_fn(1);
-- Check history
--\echo 'monitoring history fn'
--select api.monitoring_history_fn();
--select api.monitoring_history_fn('24');