<commit_before>describe('Request JSON metadata', function () {
    it('As anonymous', function () {
        cy.logout();

        var metadata = cy.request({
            url: 'index.php/view/app/metadata',
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")
            expect(response.body.qgis_server_info.error).to.eq("NO_ACCESS")
        });
    })

    it('As admin using basic auth', function () {
        cy.logout()

        var request = cy.request({
            url: 'index.php/view/app/metadata',
            headers:{
                authorization:'Basic YWRtaW46YWRtaW4=',
            },
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")

            expect(response.body.qgis_server_info.metadata.py_qgis_server).to.eq(true)
            expect(response.body.qgis_server_info.metadata.py_qgis_server_version).to.contain('.')
            expect(response.body.qgis_server_info.metadata.version).to.contain('3.')
            expect(response.body.qgis_server_info.plugins.lizmap_server.version).to.contain('alpha')
        });
    })

    it('As admin using UI', function () {
        cy.loginAsAdmin()

        var request = cy.request({
            url: 'index.php/view/app/metadata',
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")

            expect(response.body.qgis_server_info.metadata.py_qgis_server).to.eq(true)
            expect(response.body.qgis_server_info.metadata.py_qgis_server_version).to.contain('.')
            expect(response.body.qgis_server_info.metadata.version).to.contain('3.')
            expect(response.body.qgis_server_info.plugins.lizmap_server.version).to.contain("alpha")
        });
    })

    it('As normal user using UI', function () {
        cy.loginAsUserA()

        var request = cy.request({
            url: 'index.php/view/app/metadata',
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")
            expect(response.body.qgis_server_info.error).to.eq("NO_ACCESS")
        });
    })
})<commit_msg>Cypress - Allow a dev lizmap_server version when testing<commit_after>describe('Request JSON metadata', function () {
    it('As anonymous', function () {
        cy.logout();

        var metadata = cy.request({
            url: 'index.php/view/app/metadata',
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")
            expect(response.body.qgis_server_info.error).to.eq("NO_ACCESS")
        });
    })

    it('As admin using basic auth', function () {
        cy.logout()

        var request = cy.request({
            url: 'index.php/view/app/metadata',
            headers:{
                authorization:'Basic YWRtaW46YWRtaW4=',
            },
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")

            expect(response.body.qgis_server_info.metadata.py_qgis_server).to.eq(true)
            expect(response.body.qgis_server_info.metadata.py_qgis_server_version).to.contain('.')
            expect(response.body.qgis_server_info.metadata.version).to.contain('3.')
            expect(response.body.qgis_server_info.plugins.lizmap_server.version).to.match(/(\.|master|dev)/i)
        });
    })

    it('As admin using UI', function () {
        cy.loginAsAdmin()

        var request = cy.request({
            url: 'index.php/view/app/metadata',
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")

            expect(response.body.qgis_server_info.metadata.py_qgis_server).to.eq(true)
            expect(response.body.qgis_server_info.metadata.py_qgis_server_version).to.contain('.')
            expect(response.body.qgis_server_info.metadata.version).to.contain('3.')
            expect(response.body.qgis_server_info.plugins.lizmap_server.version).to.match(/(\.|master|dev)/i)
        });
    })

    it('As normal user using UI', function () {
        cy.loginAsUserA()

        var request = cy.request({
            url: 'index.php/view/app/metadata',
            failOnStatusCode: false,
        }).then((response) => {
            expect(response.status).to.eq(200);
            expect(response.headers['content-type']).to.eq('application/json');
            expect(response.body.qgis_server.test).to.eq("OK")
            expect(response.body.qgis_server_info.error).to.eq("NO_ACCESS")
        });
    })
})
{'fraction_non_alphanumeric': 0.15595680651442734, 'fraction_numerical': 0.0060187643830766505, 'mean_word_length': 2.3711217183770885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2496037', 'n_tokens_mistral': 1757, 'n_tokens_neox': 1726, 'n_words': 177}