<commit_before>module.exports = function() {
  const DEFAULT_HOST = 'localhost';
  const DEFAULT_PORT = 8080;

  let frisby = require('frisby');

  let host = process.env.VOLONTARIO_EXPRESS_HOST || DEFAULT_HOST;
  let port = process.env.VOLONTARIO_EXPRESS_PORT || DEFAULT_PORT;
  let url = 'http://' + host + ':' + port;

  frisby.create('Make sure the API returns something')
    .get(url)
    .expectStatus(200)
    .expectBodyContains('{}')
    .toss();

  frisby.create('Create a new location')
    .post(url + '/locations', {
      category: 'testing',
      latitude: 60.000,
      longitude: 20.000,
      name: 'Testing Location',
      url: 'http://location-testing-url/'
    })
    .expectStatus(200)
    .toss();

  frisby.create('Delete testing locations')
    .delete(url + '/locations', {category: 'testing'})
    .expectStatus(200)
    .toss();

  frisby.create('Create a new event')
    .post(url + '/events', {
      category: 'testing',
      latitude: 62.000,
      longitude: 22.000,
      name: 'Testing Event',
      origin: 'test_run',
      originalId: 'Original Testing Event',
      url: 'http://event-testing-url/'
    })
    .expectStatus(200)
    .toss();

  frisby.create('Delete testing events')
    .delete(url + '/events', {category: 'testing'})
    .expectStatus(200)
    .toss();

  frisby.create('Create a new user')
    .post(url + '/users', {
      dateOfBirth: '1990-12-01',
      email: '<EMAIL>',
      familyName: 'User',
      givenName: 'Testing',
      latitude: 58.000,
      longitude: 18.000,
      password: '<PASSWORD>',
      phoneNumber: '+35850000000',
      tags: 'tagA,tagB,tagC'
    })
    .expectStatus(200)
    .toss();

  frisby.create('Delete testing users')
    .delete(url + '/users', {email: '<EMAIL>'})
    .expectStatus(200)
    .toss();
};<commit_msg>Make tests use HTTP Basic Auth<commit_after>module.exports = function() {
  const DEFAULT_HOST = 'localhost';
  const DEFAULT_PORT = 8080;

  const TESTING_EMAIL = '<EMAIL>';
  const TESTING_PASSWORD = '<PASSWORD>';

  let frisby = require('frisby');

  let credentials = encodeURIComponent(TESTING_EMAIL + ':' + TESTING_PASSWORD);
  let host = process.env.VOLONTARIO_EXPRESS_HOST || DEFAULT_HOST;
  let port = process.env.VOLONTARIO_EXPRESS_PORT || DEFAULT_PORT;
  let url = 'http://' + credentials + '@' + host + ':' + port;

  frisby.create('Make sure the API returns something')
    .get(url)
    .expectStatus(200)
    .expectBodyContains('{}')
    .toss();

  frisby.create('Create a testing user')
    .post(url + '/users', {
      dateOfBirth: '1990-12-01',
      email: TESTING_EMAIL,
      familyName: 'User',
      givenName: 'Testing',
      latitude: 58.000,
      longitude: 18.000,
      password: <PASSWORD>,
      phoneNumber: '+35850000000',
      tags: 'tagA,tagB,tagC'
    })
    .expectStatus(200)
    .after(function() {
      frisby.create('Create a new location')
        .post(url + '/locations', {
          category: 'testing',
          latitude: 60.000,
          longitude: 20.000,
          name: 'Testing Location',
          url: 'http://location-testing-url/'
        })
        .expectStatus(200)
        .toss();

      frisby.create('Delete testing locations')
        .delete(url + '/locations', {category: 'testing'})
        .expectStatus(200)
        .toss();

      frisby.create('Create a new event')
        .post(url + '/events', {
          category: 'testing',
          latitude: 62.000,
          longitude: 22.000,
          name: '<NAME>',
          origin: 'test_run',
          originalId: 'Original Testing Event',
          url: 'http://event-testing-url/'
        })
        .expectStatus(200)
        .toss();

      frisby.create('Delete testing events')
        .delete(url + '/events', {category: 'testing'})
        .expectStatus(200)
        .toss();
    })
    .toss();

  frisby.create('Delete testing users')
    .delete(url + '/users', {email: '<EMAIL>'})
    .expectStatus(200)
    .toss();
};
{'fraction_non_alphanumeric': 0.16218254966054815, 'fraction_numerical': 0.03721398038722655, 'mean_word_length': 2.5549597855227884, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '3544550', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1297, 'n_words': 278}