mirror of
https://github.com/openMF/community-app.git
synced 2026-02-06 14:11:54 +00:00
changes from duda session
This commit is contained in:
parent
06788ad352
commit
f99933cfee
@ -13,6 +13,25 @@
|
||||
<script type="text/javascript" src="../app/bower_components/underscore/underscore-min.js"></script>
|
||||
<script type="text/javascript" src="../app/bower_components/angular/angular.min.js"></script>
|
||||
|
||||
<!-- include source files here... -->
|
||||
<script type="text/javascript" src="../app/scripts/mifosX.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/models/roleMap.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/models/LoggedInUser.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/models/Role.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/AuthenticationService.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/SessionManager.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/HttpServiceProvider.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/ResourceFactoryProvider.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/directives/DataTablesDirective.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/directives/OverlayDirective.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/directives/DialogDirective.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/main/MainController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/main/LoginFormController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/organization/RoleController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/user/UserController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/user/UserFormController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/user/UserListController.js"></script>
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script type="text/javascript" src="spec/specHelper.js"></script>
|
||||
<script type="text/javascript" src="spec/models/LoggedInUserSpec.js"></script>
|
||||
@ -29,24 +48,8 @@
|
||||
<script type="text/javascript" src="spec/controllers/RoleControllerSpec.js"></script>
|
||||
<script type="text/javascript" src="spec/controllers/UserControllerSpec.js"></script>
|
||||
<script type="text/javascript" src="spec/controllers/UserFormControllerSpec.js"></script>
|
||||
<script type="text/javascript" src="spec/controllers/UserListControllerSpec.js"></script>
|
||||
|
||||
<!-- include source files here... -->
|
||||
<script type="text/javascript" src="../app/scripts/mifosX.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/models/roleMap.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/models/LoggedInUser.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/models/Role.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/AuthenticationService.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/SessionManager.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/HttpServiceProvider.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/services/ResourceFactoryProvider.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/directives/DataTablesDirective.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/directives/OverlayDirective.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/directives/DialogDirective.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/MainController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/LoginFormController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/RoleController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/UserController.js"></script>
|
||||
<script type="text/javascript" src="../app/scripts/controllers/UserFormController.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
|
||||
@ -24,13 +24,13 @@ describe("UserController", function() {
|
||||
expect(this.scope.$broadcast).toHaveBeenCalledWith('UserDataLoadingStartEvent');
|
||||
});
|
||||
|
||||
it("should call the userResource with the correct field selection", function() {
|
||||
expect(this.resourceFactory.userResource.getAllUsers).toHaveBeenCalledWith({fields: "id,firstname,lastname,username,officeName"}, jasmine.any(Function));
|
||||
});
|
||||
it("should call the userResource with the correct field selection", function() {
|
||||
expect(this.resourceFactory.userResource.getAllUsers).toHaveBeenCalledWith({fields: "id,firstname,lastname,username,officeName"}, jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("should populate the scope with the retrieved users", function() {
|
||||
resourceCallback(["test_user1", "test_user2"]);
|
||||
|
||||
|
||||
expect(this.scope.users).toEqual(["test_user1", "test_user2"]);
|
||||
});
|
||||
|
||||
|
||||
26
test/spec/controllers/UserListControllerSpec.js
Normal file
26
test/spec/controllers/UserListControllerSpec.js
Normal file
@ -0,0 +1,26 @@
|
||||
describe("UserListController", function() {
|
||||
var resourceCallback;
|
||||
beforeEach(function() {
|
||||
this.scope = {
|
||||
$broadcast: jasmine.createSpy("$scope.$broadcast(")
|
||||
};
|
||||
|
||||
this.resourceFactory = {userListResource: {
|
||||
getAllUsers: jasmine.createSpy('userResource.getAllUsers()').andCallFake(function(params, callback) {
|
||||
resourceCallback = callback;
|
||||
})
|
||||
}};
|
||||
|
||||
this.controller = new mifosX.controllers.UserListController(this.scope, this.resourceFactory);
|
||||
});
|
||||
|
||||
it("should call the userResource with the correct method", function() {
|
||||
expect(this.resourceFactory.userListResource.getAllUsers).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should populate the scope with the retrieved users", function() {
|
||||
resourceCallback(["test_user1", "test_user2"]);
|
||||
expect(this.scope.users).toEqual(["test_user1", "test_user2"]);
|
||||
});
|
||||
|
||||
});
|
||||
@ -15,12 +15,12 @@ describe("AuthenticationService", function() {
|
||||
|
||||
new mifosX.services.AuthenticationService(scope, httpService).authenticateWithUsernamePassword({
|
||||
username: "test_username",
|
||||
password: "test_password",
|
||||
password: "test_password"
|
||||
});
|
||||
});
|
||||
|
||||
it("should pass the correct parameters to the post method", function() {
|
||||
expect(httpService.post).toHaveBeenCalledWith("/authentication?username=test_username&password=test_password");
|
||||
expect(httpService.post).toHaveBeenCalledWith("/mifosng-provider/api/v1/authentication?username=test_username&password=test_password");
|
||||
});
|
||||
|
||||
it("should broadcast 'UserAuthenticationStartEvent'", function() {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
describe("ResourceFactoryProvider", function() {
|
||||
var ngResource;
|
||||
var ngResource,
|
||||
apiVersion = "/mifosng-provider/api/v1";
|
||||
beforeEach(function() {
|
||||
this.provider = new mifosX.services.ResourceFactoryProvider();
|
||||
ngResource = jasmine.createSpy("$resource").andReturn("test_resource");
|
||||
@ -9,7 +10,7 @@ describe("ResourceFactoryProvider", function() {
|
||||
|
||||
describe("User resource", function() {
|
||||
it("should define the User resource", function() {
|
||||
expect(ngResource).toHaveBeenCalledWith("/users/:userId", {}, {
|
||||
expect(ngResource).toHaveBeenCalledWith(apiVersion + "/users/:userId", {}, {
|
||||
getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true}
|
||||
});
|
||||
expect(this.factory.userResource).toEqual("test_resource");
|
||||
@ -18,7 +19,7 @@ describe("ResourceFactoryProvider", function() {
|
||||
|
||||
describe("Role resource", function() {
|
||||
it("should define the Role resource", function() {
|
||||
expect(ngResource).toHaveBeenCalledWith("/roles/:roleId", {}, {
|
||||
expect(ngResource).toHaveBeenCalledWith(apiVersion + "/roles/:roleId", {}, {
|
||||
getAllRoles: {method: 'GET', params: {}, isArray: true}
|
||||
});
|
||||
expect(this.factory.roleResource).toEqual("test_resource");
|
||||
@ -27,8 +28,9 @@ describe("ResourceFactoryProvider", function() {
|
||||
|
||||
describe("Office resource", function() {
|
||||
it("should define the Office resource", function() {
|
||||
expect(ngResource).toHaveBeenCalledWith("/offices/:officeId", {}, {
|
||||
getAllOffices: {method: 'GET', params: {}, isArray: true}
|
||||
expect(ngResource).toHaveBeenCalledWith(apiVersion + "/offices/:officeId", {officeId:"@officeId"}, {
|
||||
getAllOffices: {method: 'GET', params: {}, isArray: true},
|
||||
update: {method: 'PUT'}
|
||||
});
|
||||
expect(this.factory.officeResource).toEqual("test_resource");
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user