<commit_before>var should = require('chai').should(),
    expect = require('chai').expect(),
    supertest = require('supertest'),
    request = require('request'),
    api = supertest('http://127.0.0.1:9090');


describe("Server is up check", function () {
    it('should return 200 response', function (done) {
        api.get('/')
            .set('Accept', 'application/json')
            .expect(200, done);
    });
});


// describe("Server is up check", function() {
//   it('should return 200 response', function(done){
//     api.get('/')

//     .set('Accept', 'application/json')
//     .expect(200, done);
//   });
// });
//
// // describe("/api is forbidden", function() {
// //   it('should return 403 response', function(done){
// //     api.get('/api')
// //     .set('Accept', 'application/json')
// //     .expect(403, done);
// //   });
// // });
//
// describe("New user creation test", function() {
//   it('No parameters should return 400 response', function(done){
//     api.post('/setup')
//     .set('Accept', 'application/x-www-form-urlencoded')
//     .send()
//   .expect(400, done);
//   });
//
//   it('Username parameter only should return 400 response', function(done){
//     api.post('/setup')
//     .set('Accept', 'application/x-www-form-urlencoded')
//     .send({
//       username: "<EMAIL>"
//     })
//   .expect(400, done);
//   });
//
//   it('Password parameter only should return 400 response', function(done){
//     api.post('/setup')
//     .set('Accept', 'application/x-www-form-urlencoded')
//     .send({
//       password: "<PASSWORD>"
//     })
//   .expect(400, done);
//   });
//
//   // it('New user creation should have 200 response', function(done){
//   //   api.post('/setup')
//   //   .set('Accept', 'application/x-www-form-urlencoded')
//   //   .send({
//   //     username: "<EMAIL>",
//   //     password: "<PASSWORD>"
//   //   })
//   // .expect(200, done);
//   // });
//
// });


describe("New user creation test", function () {
    it('No parameters should return 400 response', function (done) {
        api.post('/setup')
            .set('Accept', 'application/x-www-form-urlencoded')
            .send()
            .expect(400, done);
    });

    it('Username parameter only should return 400 response', function (done) {
        api.post('/setup')
            .set('Accept', 'application/x-www-form-urlencoded')
            .send({
                username: "<EMAIL>"
            })
            .expect(400, done);
    });

    it('Password parameter only should return 400 response', function (done) {
        api.post('/setup')
            .set('Accept', 'application/x-www-form-urlencoded')
            .send({
                password: "<PASSWORD>"
            })
            .expect(400, done);
    });

    // it('New user creation should have 200 response', function(done){
    //   api.post('/setup')
    //   .set('Accept', 'application/x-www-form-urlencoded')
    //   .send({
    //     username: "<EMAIL>",
    //     password: "<PASSWORD>"
    //   })
    // .expect(200, done);
    // });


    it('Login should redirect to home and return a user token', function (done) {
        var postData = {
            username: '<EMAIL>',
            password: '<PASSWORD>'
        };

        var options = {
            uri: 'http://127.0.0.1:9090/login',
            followAllRedirects: true
        };

        request.post(options)
            .form(postData)
            .on('response', function (res) {
                res.statusCode.should.equal(200);
                console.log(res.headers);
            })
            .on('data', function (data) {
                should.exist(data);
                should.fail(0, 1, 'Test not implemented');
                done();
            })
            .on('error', function (e) {

            });

    });
});

// it('Login should redirect to home and return a user token', function(done) {
//   var postData = {
//     username : '<EMAIL>',
//     password : '<PASSWORD>'
//   };
//
//   var options = {
//     uri: 'http://127.0.0.1:9090/login',
//     followAllRedirects: true
//   };
//
//   request.post(options)
//     .form(postData)
//     .on('response', function(res) {
//       res.statusCode.should.equal(200);
//       console.log(res.headers);
//     })
//     .on('data',function(data) {
//       should.exist(data);
//       should.fail(0,1,'Test not implemented');
//       done();
//     })
//     .on('error', function(e) {<commit_msg>Tests added<commit_after>var should = require('chai').should(),
    expect = require('chai').expect(),
    supertest = require('supertest'),
    request = require('request'),
    httpServer = supertest('http://localhost:8080');


describe("HTTP server is up check", function () {
    it('should return 200 response', function (done) {
        httpServer.get('/')
            .set('Accept', 'application/json')
            .expect(200, done);
    });
});

describe("/login accessible", function () {
    it('should return 200 response', function (done) {
        httpServer.get('/login')
            .set('Accept', 'application/json')
            .expect(200, done);
    });
});

describe("/signup accessible", function () {
    it('should return 200 response', function (done) {
        httpServer.get('/signup')
            .set('Accept', 'application/json')
            .expect(200, done);
    });
});

describe("/home not accessible", function () {
    it('should return 302 response', function (done) {
        httpServer.get('/home')
            .set('Accept', 'application/json')
            .expect(302, done);
    });
});

describe("/profile not accessible", function () {
    it('should return 302 response', function (done) {
        httpServer.get('/profile')
            .set('Accept', 'application/json')
            .expect(302, done);
    });
});


//
// describe("New user creation test", function() {
//   it('No parameters should return 400 response', function(done){
//     api.post('/setup')
//     .set('Accept', 'application/x-www-form-urlencoded')
//     .send()
//   .expect(400, done);
//   });
//
//   it('Username parameter only should return 400 response', function(done){
//     api.post('/setup')
//     .set('Accept', 'application/x-www-form-urlencoded')
//     .send({
//       username: "<EMAIL>"
//     })
//   .expect(400, done);
//   });
//
//   it('Password parameter only should return 400 response', function(done){
//     api.post('/setup')
//     .set('Accept', 'application/x-www-form-urlencoded')
//     .send({
//       password: "<PASSWORD>"
//     })
//   .expect(400, done);
//   });
//
//   // it('New user creation should have 200 response', function(done){
//   //   api.post('/setup')
//   //   .set('Accept', 'application/x-www-form-urlencoded')
//   //   .send({
//   //     username: "sh<EMAIL>",
//   //     password: "<PASSWORD>"
//   //   })
//   // .expect(200, done);
//   // });
//
// });


//describe("New user creation test", function () {
//    it('No parameters should return 400 response', function (done) {
//        api.post('/setup')
//            .set('Accept', 'application/x-www-form-urlencoded')
//            .send()
//            .expect(400, done);
//    });
//
//    it('Username parameter only should return 400 response', function (done) {
//        api.post('/setup')
//            .set('Accept', 'application/x-www-form-urlencoded')
//            .send({
//                username: "<EMAIL>"
//            })
//            .expect(400, done);
//    });
//
//    it('Password parameter only should return 400 response', function (done) {
//        api.post('/setup')
//            .set('Accept', 'application/x-www-form-urlencoded')
//            .send({
//                password: "<PASSWORD>"
//            })
//            .expect(400, done);
//    });

// it('New user creation should have 200 response', function(done){
//   api.post('/setup')
//   .set('Accept', 'application/x-www-form-urlencoded')
//   .send({
//     username: "<EMAIL>",
//     password: "<PASSWORD>"
//   })
// .expect(200, done);
// });


//    it('Login should redirect to home and return a user token', function (done) {
//        var postData = {
//            username: '<EMAIL>',
//            password: '<PASSWORD>'
//        };
//
//        var options = {
//            uri: 'http://127.0.0.1:9090/login',
//            followAllRedirects: true
//        };
//
//        request.post(options)
//            .form(postData)
//            .on('response', function (res) {
//                res.statusCode.should.equal(200);
//                console.log(res.headers);
//            })
//            .on('data', function (data) {
//                should.exist(data);
//                should.fail(0, 1, 'Test not implemented');
//                done();
//            })
//            .on('error', function (e) {
//
//            });
//
//    });
//});

// it('Login should redirect to home and return a user token', function(done) {
//   var postData = {
//     username : '<EMAIL>',
//     password : '<PASSWORD>'
//   };
//
//   var options = {
//     uri: 'http://127.0.0.1:9090/login',
//     followAllRedirects: true
//   };
//
//   request.post(options)
//     .form(postData)
//     .on('response', function(res) {
//       res.statusCode.should.equal(200);
//       console.log(res.headers);
//     })
//     .on('data',function(data) {
//       should.exist(data);
//       should.fail(0,1,'Test not implemented');
//       done();
//     })
//     .on('error', function(e) {
{'fraction_non_alphanumeric': 0.21085726262837978, 'fraction_numerical': 0.022846363445818488, 'mean_word_length': 1.8275555555555556, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 16, 'xml': 0}, 'pii_count': 5, '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': '2920489', 'n_tokens_mistral': 3026, 'n_tokens_neox': 2837, 'n_words': 583}