<commit_before>var configuration = require("./spec/smokes/configuration")

var authenticated = function(url) {
  return(url + "?api_key=" + configuration.API_KEY);
}

var url     = configuration.BASE_URL + '/api/v1/viz';
var payload = {
  name:   'Visualization',
  tags:   ['tag1', 'tag2'],
  map_id: 5
};

var headers = {
  'Content-Type': 'application/json',
  'Host'        : configuration.HOST
}

casper.echo(configuration.HOST)
casper.start()

casper.open(authenticated(url), { 
  method:   'post',
  data:     JSON.stringify(payload),
  headers:  headers
});

casper.then(function() {
  casper.echo(url)
});

casper.run();
<commit_msg>first working smoke test for visualizations api<commit_after>var configuration = require("./spec/smokes/configuration")

var authenticated = function(url) {
  return(url + "?api_key=" + configuration.API_KEY);
}

var url     = configuration.BASE_URL + '/api/v1/viz';
var payload = {
  name:   'Visualization',
  tags:   ['tag1', 'tag2'],
  map_id: 5
};

var headers = {
  'Host'        : configuration.HOST,
  'Content-Type': 'application/json',
  'Accept'      : 'application/json'
}

casper.echo(configuration.HOST)
casper.start()

casper.open(authenticated(url), { 
  method:   'post',
  data:     JSON.stringify(payload),
  headers:  headers
});

casper.then(function() {
  response = JSON.parse(casper.getPageContent());
  casper.test.assertEquals(response['name'], payload['name']);
  require('utils').dump(response);
});

casper.run();

{'fraction_non_alphanumeric': 0.17104377104377105, 'fraction_numerical': 0.0053872053872053875, 'mean_word_length': 4.141868512110727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3222338', 'n_tokens_mistral': 514, 'n_tokens_neox': 505, 'n_words': 92}