/*
 * Arrebol Consultancy copyright.
 * 
 * This code belongs to Arrebol Consultancy
 * its use, redistribution or modification are prohibited 
 * without written authorization from Arrebol Consultancy.
 */
package com.arrebol.apc.controller.system.user;

import com.arrebol.apc.model.core.Permission;
import com.arrebol.apc.model.core.UserByOffice;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;

/**
 *
 * @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
 */
public class UserAccessControllerTest {

    private UserAccessController controller;
    private UserByOffice userByOffice;

    public UserAccessControllerTest() {
    }

    @Before
    public void init() {
        controller = new UserAccessController();
        userByOffice = new UserByOffice("d855f570-7dbb-11ea-9b1f-500320958bf8");
    }

    //@Test
    public void loadUserByOfficePermissionLst() {
        try {
            List source = controller.loadUserByOfficePermissionLst(userByOffice, true);
            List target = controller.loadUserByOfficePermissionLst(userByOffice, false);

            System.out.println("SOURCE");
            source.forEach(System.out::println);
            System.out.println("TARGET");
            target.forEach(System.out::println);

            assertFalse(source.isEmpty());
            assertFalse(target.isEmpty());
        } catch (Exception e) {
            assertFalse(true);
        }
    }

    @Test
    public void findAllEnebledPermissions() {
        try {
            List<Permission> permissions = controller.findAllEnebledPermissions();

            permissions.forEach(System.out::println);

            assertFalse(permissions.isEmpty());
        } catch (Exception e) {
            assertFalse(true);
        }
    }

}
