Exemplo n.º 1
0
    def get_list_of_containers(self):
        """
        Get a list of containers from the user using the input() method

        Converts the input to lowercase and to an array.
        """
        self.containers: List[str] = Response.ask_for_input(
            "Containers to Build: ").split()
        # then lower case each item
        self.containers = [x.lower() for x in self.containers]
        # check with the user
        Response.show_info('Containers: {}'.format(self.containers))
        project_containers_are_ok: bool = Response.ask_for_input(
            'Is this ok? [y/n]: ').lower()
        if project_containers_are_ok != 'y':
            Response.show_error('Exiting...')
Exemplo n.º 2
0
    def set_path(self):
        """
        Saves the directory the user was in when they ran the main script to be used as the project root

        e.g. The path in the bash prompt
        """
        name: str = Response.ask_for_input(
            "Project name (lowercase, hyphen-seperated): ")
        self.name: str = name
        self.path: str = os.getcwd() + '/' + name
Exemplo n.º 3
0
 def test_ask_for_input(self):
     #mocked_input.side_effect = ['Albert Einstein', '42.81', 'done']
     result = Response.ask_for_input('hi')
     self.assertEqual(result, 'Hello')