Commit 7ef6d9b3 authored by Evren Kutar's avatar Evren Kutar

rest url DRY prensibine göre güncellendi

parent b311140e
...@@ -59,11 +59,11 @@ describe('zaerp.auth module', function () { ...@@ -59,11 +59,11 @@ describe('zaerp.auth module', function () {
}); });
it('should get login success', it('should get login success',
inject(function(LoginService, $httpBackend, $location) { inject(function(LoginService, $httpBackend, $location, RESTURL) {
// use httpBackend to imitate login api // use httpBackend to imitate login api
$httpBackend.expectGET('http://127.0.0.1:3000/api/login?email=test@test.com&password=password&') $httpBackend.expectGET(RESTURL.url + 'login?email=test@test.com&password=password&')
// todo: with real api change response data from list to obj // todo: with real api change response data from list to obj
.respond(200, [{'id': 1, 'user': {'id': 12, 'role': 'admin'}, 'success': true}]); .respond(200, [{'id': 1, 'user': {'id': 12, 'role': 'admin'}, 'success': true}]);
......
...@@ -36,15 +36,15 @@ describe('form service module', function () { ...@@ -36,15 +36,15 @@ describe('form service module', function () {
); );
it('should get form', it('should get form',
inject(function(Generator, $httpBackend) { inject(function(Generator, $httpBackend, RESTURL) {
$httpBackend.expectGET('http://127.0.0.1:3000/api/student/add?email=test@test.com&') $httpBackend.expectGET(RESTURL.url + 'student/add?email=test@test.com&')
.respond(204, {'id': 1, 'user': {'id': 12, 'role': 'admin'}}); .respond(200, [{form: 'form'}]);
var cred = {email: 'test@test.com'}; var cred = {email: 'test@test.com'};
Generator.get_form('student/add', cred) Generator.get_form('student/add', cred)
.then(function(data) { .then(function(data) {
expect(data).not.toBe(null); expect(data).toEqual({form: 'form'});
}); });
$httpBackend.flush(); $httpBackend.flush();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment