<commit_before>/*
 This set of UT validate request/responses
 against public resources.
 */

var request = require('supertest'),
    should = require('should');

var host = 'http://127.0.0.1:8082';

var app = request(host);

var population_order = 4;

var receivers = new Array();
var receivers_ids = new Array();
var contexts = new Array();
var contexts_ids = new Array();
var fields = new Array();
var fields_ids = new Array();

var authentication;
var node;

var valid_admin_login = {
  'username': 'admin',
  'password': '<PASSWORD>'
}

var receiver = {
  id: '',
  role: 'receiver',
  username: '',
  name: '',
  can_delete_submission: false,
  contexts: [],
  timezone: 0,
  language: 'en',
  description: '',
  pgp_key_public: '',
  pgp_key_expiration: '',
  pgp_key_fingerprint: '',
  pgp_key_info: '',
  pgp_key_remove: false,
  pgp_key_status: 'ignored',
  mail_address: '<EMAIL>', // used 'Recipient N' for population
  ping_mail_address: '',
  password: '<PASSWORD>',
  old_password: '',
  password_change_needed: false,
  can_postpone_expiration: true,
  presentation_order: 0,
  tip_notification: false,
  ping_notification: false,
  tip_expiration_threshold: 72,
  configuration: 'default',
  state: 'enabled',
  deletable: 'true'
}

var fields = [
  {
    id: '',
    instance: 'instance',
    template_id: '',
    step_id: '',
    fieldgroup_id: '',
    label: 'Question 1',
    type: 'inputbox',
    preview: false,
    description: 'description',
    hint: 'field hint',
    multi_entry: false,
    multi_entry_hint: '',
    stats_enabled: false,
    required: true,
    attrs: {},
    options: [],
    children: [],
    y: 1,
    x: 0,
    width: 0
  },
  {
    id: '',
    instance: 'instance',
    template_id: '',
    step_id: '',
    fieldgroup_id: '',
    label: 'Question 2',
    type: 'inputbox',
    preview: false,
    description: 'description',
    hint: 'field hint',
    multi_entry: false,
    multi_entry_hint: '',
    stats_enabled: false,
    required: false,
    attrs: {},
    options: [],
    children: [],
    y: 2,
    x: 0,
    width: 0
  },
  {
    id: '',
    instance: 'instance',
    template_id: '',
    step_id: '',
    fieldgroup_id: '',
    label: 'Question 3',
    type: 'inputbox',
    preview: false,
    description: 'description',
    hint: 'field hint',
    multi_entry: false,
    multi_entry_hint: '',
    stats_enabled: false,
    required: false,
    attrs: {},
    options: [],
    children: [],
    y: 3,
    x: 0,
    width: 0
  }
]

var context = {
  id: '',
  name: 'Context 1',
  description: '',
  presentation_order: 0,
  tip_timetolive: 15,
  can_postpone_expiration: false,
  can_delete_submission: true,
  show_context: true,
  show_receivers: true,
  show_small_cards: false,
  enable_comments: true,
  enable_messages: true,
  enable_two_way_communication: true,
  enable_attachments: true,
  select_all_receivers: true,
  show_receivers_in_alphabetical_order: false,
  steps_arrangement: 'horizontal',
  reset_questionnaire: true,
  maximum_selectable_receivers:0,
  receivers: [],
  custodians: [],
  steps: []
}

var validate_mandatory_headers = function(headers) {
  var mandatory_headers = {
    'X-XSS-Protection': '1; mode=block',
    'X-Robots-Tag': 'noindex',<commit_msg>Update API tests in relation to latest develepment<commit_after>/*
 This set of UT validate request/responses
 against public resources.
 */

var request = require('supertest'),
    should = require('should');

var host = 'http://127.0.0.1:8082';

var app = request(host);

var population_order = 4;

var receivers = new Array();
var receivers_ids = new Array();
var contexts = new Array();
var contexts_ids = new Array();
var fields = new Array();
var fields_ids = new Array();

var authentication;
var node;

var valid_admin_login = {
  'username': 'admin',
  'password': '<PASSWORD>'
}

var receiver = {
  id: '',
  role: 'receiver',
  username: '',
  name: '',
  can_delete_submission: false,
  contexts: [],
  timezone: 0,
  language: 'en',
  description: '',
  pgp_key_public: '',
  pgp_key_expiration: '',
  pgp_key_fingerprint: '',
  pgp_key_info: '',
  pgp_key_remove: false,
  pgp_key_status: 'ignored',
  mail_address: '<EMAIL>', // used 'Recipient N' for population
  ping_mail_address: '',
  password: '<PASSWORD>',
  old_password: '',
  password_change_needed: false,
  can_postpone_expiration: true,
  presentation_order: 0,
  tip_notification: false,
  ping_notification: false,
  tip_expiration_threshold: 72,
  configuration: 'default',
  state: 'enabled',
  deletable: 'true'
}

var fields = [
  {
    id: '',
    instance: 'instance',
    template_id: '',
    step_id: '',
    fieldgroup_id: '',
    label: 'Question 1',
    type: 'inputbox',
    preview: false,
    description: 'description',
    hint: 'field hint',
    multi_entry: false,
    multi_entry_hint: '',
    stats_enabled: false,
    required: true,
    attrs: {},
    options: [],
    children: [],
    y: 1,
    x: 0,
    width: 0
  },
  {
    id: '',
    instance: 'instance',
    template_id: '',
    step_id: '',
    fieldgroup_id: '',
    label: 'Question 2',
    type: 'inputbox',
    preview: false,
    description: 'description',
    hint: 'field hint',
    multi_entry: false,
    multi_entry_hint: '',
    stats_enabled: false,
    required: false,
    attrs: {},
    options: [],
    children: [],
    y: 2,
    x: 0,
    width: 0
  },
  {
    id: '',
    instance: 'instance',
    template_id: '',
    step_id: '',
    fieldgroup_id: '',
    label: 'Question 3',
    type: 'inputbox',
    preview: false,
    description: 'description',
    hint: 'field hint',
    multi_entry: false,
    multi_entry_hint: '',
    stats_enabled: false,
    required: false,
    attrs: {},
    options: [],
    children: [],
    y: 3,
    x: 0,
    width: 0
  }
]

var context = {
  id: '',
  name: 'Context 1',
  description: '',
  presentation_order: 0,
  tip_timetolive: 15,
  can_postpone_expiration: false,
  can_delete_submission: true,
  hidden: false,
  show_receivers: true,
  show_small_cards: false,
  enable_comments: true,
  enable_messages: true,
  enable_two_way_communication: true,
  enable_attachments: true,
  select_all_receivers: true,
  show_receivers_in_alphabetical_order: false,
  steps_arrangement: 'horizontal',
  reset_questionnaire: true,
  maximum_selectable_receivers:0,
  receivers: [],
  custodians: [],
  steps: []
}

var validate_mandatory_headers = function(headers) {
  var mandatory_headers = {
    'X-XSS-Protection': '1; mode=block',
    'X-Robots-Tag': 'noindex',
{'fraction_non_alphanumeric': 0.14495412844036698, 'fraction_numerical': 0.010091743119266056, 'mean_word_length': 3.4076819407008085, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3826118', 'n_tokens_mistral': 2326, 'n_tokens_neox': 2258, 'n_words': 536}