<commit_before>/***********************************************************

 The information in this document is proprietary
 to VeriSign and the VeriSign Product Development.
 It may not be used, reproduced or disclosed without
 the written approval of the General Manager of
 VeriSign Product Development.

 PRIVILEGED AND CONFIDENTIAL
 VERISIGN PROPRIETARY INFORMATION
 REGISTRY SENSITIVE INFORMATION

 Copyright (c) 2013 VeriSign, Inc.  All rights reserved.

 ***********************************************************/

var config = require('./test-config');
var server = require("../server")
var should = require('should');
var request = require('supertest');
var mongoose = null;
var schemaManager = null;
var app = null;

describe('Schema API', function() {
    before(function(done) {
        server.startServer(config, function(expressApp) {
            mongoose = server.mongoose;
            schemaManager = require('../util/schema-manager')(mongoose);
            app = expressApp;
            done();
        });
    });

    after(function(done) {
        server.stopServer();
        mongoose.connection.db.dropDatabase();
        mongoose.connection.close();
        done();
    });

    describe("GET failure cases", function() {
        // no schemas..
        it("Should fail if type is not specified ", function(done) {
            request(app).get("/v1/api/schemas").expect(404, done);
        });
        it("Should fail if type does not exist ", function(done) {
            request(app).get("/v1/api/schemas/dne").expect(404, done);
        });
    });

    describe("POST schema", function() {
        it("Should create new schemas", function(done) {
            var jsData = JSON.parse("{        \
                \"name\":\"network_element\", \
                \"definition\": {             \
                    \"ne_type\": \"String\",  \
                    \"cid\":     \"String\",  \
                    \"ip\":      \"String\",  \
                    \"ip6\":     \"String\",  \
                    \"bgpip\":   \"String\",  \
                    \"bgpip6\":  \"String\",  \
                }.                            \
            }");
            request(app).post("/v1/api/schemas")
                .set('Content-Encoding', 'application/json')
                .write(jsData)
                .expect(200);
        });
    });
});<commit_msg>Update test-api-schemas<commit_after>/***********************************************************

 The information in this document is proprietary
 to VeriSign and the VeriSign Product Development.
 It may not be used, reproduced or disclosed without
 the written approval of the General Manager of
 VeriSign Product Development.

 PRIVILEGED AND CONFIDENTIAL
 VERISIGN PROPRIETARY INFORMATION
 REGISTRY SENSITIVE INFORMATION

 Copyright (c) 2013 VeriSign, Inc.  All rights reserved.

 ***********************************************************/

var config = require('./test-config');
var server = require("../server")
var should = require('should');
var request = require('supertest');
var mongoose = null;
var schemaManager = null;
var app = null;

describe('Schema API', function() {
    before(function(done) {
        server.startServer(config, function(expressApp) {
            mongoose = server.mongoose;
            schemaManager = require('../util/schema-manager')(mongoose);
            app = expressApp;
            done();
        });
    });

    after(function(done) {
        server.stopServer();
        mongoose.connection.db.dropDatabase();
        mongoose.connection.close();
        done();
    });

    describe("GET failure cases", function() {
        // no schemas..
        it("Should fail if type is not specified ", function(done) {
            request(app).get("/v1/api/schemas").expect(404, done);
        });
        it("Should fail if type does not exist ", function(done) {
            request(app).get("/v1/api/schemas/dne").expect(404, done);
        });
    });

    describe("POST schema", function() {
        it("Should create new schemas", function(done) {
            var jsData = {
                "name":"network_element",
                "definition": {
                    "ne_type": "String",
                    "cid":     "String",
                    "ip":      "String",
                    "ip6":     "String",
                    "bgpip":   "String",
                    "bgpip6":  "String" 
                }
            };
            request(app).post("/api/v1/schemas")
                .set('Content-Encoding', 'application/json')
                .send(jsData)
                .expect(201, done);
        });
    });
});
{'fraction_non_alphanumeric': 0.18232518232518233, 'fraction_numerical': 0.007722007722007722, 'mean_word_length': 1.9814578005115089, 'pattern_counts': {'":': 16, '<': 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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '86056', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1173, 'n_words': 295}