/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arrebol.taxiservicios.controller.system;

import com.arrebol.taxiservicios.model.core.Permission;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.core.UserHasPermission;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Picasso
 */
public class PermissionControllerTest {

    static public final String PERSON_ID = "e480d163-5444-4cdf-8989-9eff3550d087";
    static public final String ANGEL_ID = "e91e9070-f08c-4fa1-8180-5554118bcd85";
    static public final String USERNAME = "ADMIN";
    static public final String USER_ID="09ea84b8-b9d1-4a71-adfe-db653b2a9982";
    static public final String AVATAR = "images/unknown.png";
    static public final String PWD = "2EF1666895D9E2C22B517FC05A12B162BAD93510AD5EED7AB3A945B4BE8D113E";
    private PermissionController controller;

    public PermissionControllerTest() {
    }

    @Before
    public void setUp() {
        controller = new PermissionController();
    }
    
    //@Test
    public void getAllActiveUserAndNotRoot() {
        try {
            List<User> users = controller.getAllActiveUserAndNotRoot();
           
            assertFalse(users.isEmpty());
        } catch (Exception e) {
            assertNotNull(null);
        }
    }
    
    //@Test
    public void loadUserById(){
        try {
            User user = controller.loadUserById(USER_ID);
            assertNotNull(user);
        } catch (Exception e) {
            assertNotNull(null);
        }
    }
    
    
    //@Test
    public void searchUsers() {
        try {
            List<String> users = controller.searchUsers("adm");

            assertFalse(users.isEmpty());
        } catch (Exception e) {
            assertNotNull(null);
        }
    }
    
    //@Test
    public void findAllPermissionFromUser() {
        try {
            List<UserHasPermission> permissions = controller.findAllPermissionFromUser(USER_ID);

            assertFalse(permissions.isEmpty());
        } catch (Exception e) {
            assertNotNull(null);
        }
    }
    
    //@Test
    public void getAllPermissiona() {
        try {
            List<Permission> permissions = controller.getAllPermissions();

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