Exemple #1
0
    def test_empty(self):
        Options = collections.namedtuple('args', 'recursive command_args')
        options = Options(recursive=False, command_args=['/some_path'])
        command = Ls()
        command.prepare(options)
        client = mock.Mock()
        response = GroupResponse()
        client.group.return_value = response

        output = command.execute(client, None)

        request = GroupRequest(namePrefix='/some_path', groupSuffix='/')
        client.group.assert_called_once_with(request)
        self.assertEqual('total 0\n', output)
Exemple #2
0
    def test_empty(self):
        Options = collections.namedtuple('args', 'recursive command_args')
        options = Options(recursive=False, command_args=['/some_path'])
        command = Ls()
        command.prepare(options)
        client = mock.Mock()
        response = GroupResponse()
        client.group.return_value = response

        output = command.execute(client, None)

        request = GroupRequest(namePrefix='/some_path', groupSuffix='/')
        client.group.assert_called_once_with(request)
        self.assertEqual('total 0\n', output)
Exemple #3
0
    def test_recursive(self):
        Options = collections.namedtuple('args', 'recursive command_args')
        options = Options(recursive=True, command_args='/')
        command = Ls()
        command.prepare(options)
        client = mock.Mock()
        # Respond 10, and that should come in the output of the executed
        # command.
        response = GroupResponse(counts={'/some_path': 10})
        client.group.return_value = response

        output = command.execute(client, None)

        self.assertEqual('total 1\n/some_path [10 token(s)]\n', output)
Exemple #4
0
    def test_recursive(self):
        Options = collections.namedtuple('args', 'recursive command_args')
        options = Options(recursive=True, command_args='/')
        command = Ls()
        command.prepare(options)
        client = mock.Mock()
        # Respond 10, and that should come in the output of the executed
        # command.
        response = GroupResponse(counts={'/some_path': 10})
        client.group.return_value = response

        output = command.execute(client, None)

        self.assertEqual('total 1\n/some_path [10 token(s)]\n', output)