Exemplo n.º 1
0
    def test_clear_all(self):
        client = self.client
        with client_ctx(Resources, client):
            res = Resources()
            res.clear(provider=True, requestor=True)

            assert len(client.clear_dir.mock_calls) == 1
Exemplo n.º 2
0
    def test_clear_requestor(self):
        client = self.client
        with client_ctx(Resources, client):
            res = Resources()
            res.clear(provider=False, requestor=True)

            client.clear_dir.assert_called_with(DirectoryType.RECEIVED)
Exemplo n.º 3
0
    def test_clear_none(self):
        client = self.client
        with client_ctx(Resources, client):

            res = Resources()

            with self.assertRaises(CommandException):
                res.clear(False, False)

            assert not client.clear_dir.called
Exemplo n.º 4
0
    def test_show(self):
        dirs = dict(
            example_1='100MB',
            example_2='200MB',
        )

        client = self.client
        client.get_res_dirs_sizes.return_value = dirs

        with client_ctx(Resources, client):
            assert Resources().show() == dirs
Exemplo n.º 5
0
    def test_show(self):
        dirs = dict(
            sth='100M',
            sample='200M',
        )

        client = self.client
        client.get_res_dirs_sizes.return_value = dirs

        with client_ctx(Resources, client):
            result = Resources().show()
            assert isinstance(result, CommandResult)
            assert result.type == CommandResult.TABULAR
            assert result.data == (['sth', 'sample'], [['100M', '200M']])