--- /dev/null
+'use strict';
+
+var should = require('should');
+var app = require('../app');
+var request = require('supertest');
+var User = require('../api/user/user.model');
+
+
+var user = new User({
+ provider: 'local',
+ name: 'Fake User',
+ email: 'test@test.com',
+ password: 'password'
+});
+
+describe('AUTH module', function () {
+ before(function (done) {
+ User.remove().exec().then(function () {
+ user.save(function () {
+ done();
+ });
+ });
+ });
+
+ after(function (done) {
+ User.remove().exec().then(function () {
+ done();
+ });
+ });
+
+ it('should authenticate the user', function (done) {
+ request(app)
+ .post('/auth/local')
+ .type('json')
+ .send('{"email":"' + user.email + '", "password":"' + user.password + '"}')
+ .expect(200, done);
+ });
+
+ it('should not authenticate the user when password is wrong', function (done) {
+ request(app)
+ .post('/auth/local')
+ .type('json')
+ .send('{"email":"' + user.email + '", "password":"wrong"}')
+ .expect(401, done);
+ });
+
+ it('should not authenticate the user when mail is wrong', function (done) {
+ request(app)
+ .post('/auth/local')
+ .type('json')
+ .send('{"email":"fake", "password":"' + user.password + '"}')
+ .expect(401, done);
+ });
+});
\ No newline at end of file