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
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)
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
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
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']])