コード例 #1
0
    def insert_user(self, name: str, password: str) -> Users:
        """ Spy to all the attributes """

        self.insert_user_params["name"] = name
        self.insert_user_params["password"] = password

        return mock_users()
コード例 #2
0
    def select_user(self,
                    user_id: int = None,
                    name: str = None) -> List[Users]:
        """ Spy to all the attributes """

        self.select_user_params["user_id"] = user_id
        self.select_user_params["name"] = name

        return [mock_users()]
コード例 #3
0
    def by_name(self, name: str) -> Dict[bool, List[Users]]:
        """Select User by id"""
        self.by_id_param["name"] = name
        response = None
        validate_entry = isinstance(name, int)

        if validate_entry:
            response = [mock_users()]

        return {"Sucess": validate_entry, "Data": response}
コード例 #4
0
    def by_id(self, user_id: int) -> Dict[bool, List[Users]]:
        """Select User by id"""
        self.by_id_param["user_id"] = user_id
        response = None
        validate_entry = isinstance(user_id, int)

        if validate_entry:
            response = [mock_users()]

        return {"Sucess": validate_entry, "Data": response}
コード例 #5
0
    def register(self, name: str, password: str) -> Dict[bool, Users]:
        """Register user use case"""
        self.registry_params["name"] = name
        self.registry_params["password"] = password
        response = None
        validate_entry = isinstance(name, str) and isinstance(password, str)

        if validate_entry:
            response = mock_users()

        return {"Success": validate_entry, "Data": response}
コード例 #6
0
    def by_name_and_id(self, name: str,
                       user_id: int) -> Dict[bool, List[Users]]:
        """Select User By Name and user_id"""
        self.by_id_and_name_param["user_id"] = user_id
        self.by_id_and_name_param["user_name"] = name
        response = None
        validate = isinstance(name, str) and isinstance(user_id, int)

        if validate:
            print("Validou o user")
            response = [mock_users()]

        return {"Success": validate, "Data": response}
コード例 #7
0
    def __find_user_information(
            cls, user_information: Dict[int, str]) -> Dict[bool, List[Users]]:
        """ Check userInfo Dicionaty and select user """

        user_founded = None
        user_params = user_information.keys()

        if "user_id" and "user_name" in user_params:
            # find user by id and name
            user_founded = {"Success": True, "Data": mock_users()}

        elif "user_name" not in user_params and "user_id" in user_params:
            # find user by id
            user_founded = {"Success": True, "Data": mock_users()}

        elif "user_id" not in user_params and "user_name" in user_params:
            # find user by name
            user_founded = {"Success": True, "Data": mock_users()}

        else:
            return {"Success": False, "Data": None}

        return user_founded
コード例 #8
0
    def by_name(self, name: str) -> Dict[bool, List[Users]]:
        """Select User By name
        :param - name: name of the user
        :param - Dictionary with informations of the process
        """

        self.by_name_param["name"] = name
        response = None
        validate_entry = isinstance(name, str)

        if validate_entry:
            response = [mock_users()]

        return {"Success": validate_entry, "Data": response}
コード例 #9
0
    def by_id_and_name(self, user_id: int,
                       name: str) -> Dict[bool, List[Users]]:
        """Select User By id and name
        :param - user_id: id of the user
               - name: name of the user
        :param - Dictionary with informations of the process
        """

        self.by_id_and_name_param["user_id"] = user_id
        self.by_id_and_name_param["name"] = name
        response = None
        validate_entry = isinstance(name, str) and isinstance(user_id, int)

        if validate_entry:
            response = [mock_users()]

        return {"Success": validate_entry, "Data": response}