<commit_before>'use strict';

var request = require('supertest');
var expect = require('chai').expect;
var login = require("./../../helpers/login");
var _ = require('lodash');
var async = require('async');

describe('Generic controller test', function controllerTest() {
    [
        {
            controller: 'UserController',
            url: '/user/',
            identifier: 1,
            count: 2,
            data: {
                identifier: {
                    username: "admin",
                    email: "<EMAIL>",
                    firstName: "Arnold",
                    lastName: "Administrator",
                    admin: true
                },
                newRecord: {
                    username: "schwarzenegger",
                    email: "<EMAIL>",
                    firstName: "Arnold",
                    lastName: "Schwarzenegger",
                    admin: false
                },
                updateRecord: {
                    username: "stallone",
                    email: "<EMAIL>",
                    firstName: "Sylvester",
                    lastName: "Stallone",
                    admin: false
                }

            }
        },
        {
            controller: 'KongNodeController',
            url: '/kongnode/',
            identifier: 1,
            count: 2,
            data: {
                identifier: {
                    kong_admin_ip: "127.0.0.1",
                    kong_admin_port: "8001",
                    active: true,
                },
                newRecord: {
                    kong_admin_ip: "192.168.1.116",
                    kong_admin_port: "1234",
                    active: false,
                },
                updateRecord: {
                    kong_admin_ip: "192.168.1.118",
                    kong_admin_port: "8183",
                    active: false,
                }

            }
        }
    ].forEach(function testCase(testCase) {
        describe('for \'' + testCase.controller + '\' API endpoints', function controllerTest() {
            describe('with invalid headers', function withInvalidAuthorizationHeaders() {
                describe('GET ' + testCase.url, function getRequestTests() {
                    describe('no authorization header given', function getRequest() {
                        describe('GET ' + testCase.url, function getRequest() {
                            it('should complain about missing authorization header', function it(done) {
                                request(sails.hooks.http.app)
                                    .get(testCase.url)
                                    .set('Content-Type', 'application/json')
                                    .expect(401)<commit_msg>Fixed KongNode tests<commit_after>'use strict';

var request = require('supertest');
var expect = require('chai').expect;
var login = require("./../../helpers/login");
var _ = require('lodash');
var async = require('async');

describe('Generic controller test', function controllerTest() {
    [
        {
            controller: 'UserController',
            url: '/user/',
            identifier: 1,
            count: 2,
            data: {
                identifier: {
                    username: "admin",
                    email: "<EMAIL>",
                    firstName: "Arnold",
                    lastName: "Administrator",
                    admin: true
                },
                newRecord: {
                    username: "schwarzenegger",
                    email: "<EMAIL>",
                    firstName: "Arnold",
                    lastName: "Schwarzenegger",
                    admin: false
                },
                updateRecord: {
                    username: "stallone",
                    email: "<EMAIL>",
                    firstName: "Sylvester",
                    lastName: "Stallone",
                    admin: false
                }

            }
        },
        {
            controller: 'KongNodeController',
            url: '/kongnode/',
            identifier: 1,
            count: 2,
            data: {
                identifier: {
                    name : "node1",
                    kong_admin_ip: "127.0.0.1",
                    kong_admin_port: "8001",
                    active: true,
                },
                newRecord: {
                    name : "node2",
                    kong_admin_ip: "192.168.1.116",
                    kong_admin_port: "1234",
                    active: false,
                },
                updateRecord: {
                    name : "newname",
                    kong_admin_ip: "192.168.1.118",
                    kong_admin_port: "8183",
                    active: false,
                }

            }
        }
    ].forEach(function testCase(testCase) {
        describe('for \'' + testCase.controller + '\' API endpoints', function controllerTest() {
            describe('with invalid headers', function withInvalidAuthorizationHeaders() {
                describe('GET ' + testCase.url, function getRequestTests() {
                    describe('no authorization header given', function getRequest() {
                        describe('GET ' + testCase.url, function getRequest() {
                            it('should complain about missing authorization header', function it(done) {
                                request(sails.hooks.http.app)
                                    .get(testCase.url)
                                    .set('Content-Type', 'application/json')
                                    .expect(401)
{'fraction_non_alphanumeric': 0.10662875422072152, 'fraction_numerical': 0.016349742313843965, 'mean_word_length': 1.0736919675755343, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '928253', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1269, 'n_words': 273}