LGTM, thanks.

On Wed, Mar 26, 2014 at 2:25 PM, Hrvoje Ribicic <[email protected]> wrote:

> This patch introduces a simple test checking if a custom_* parameter is
> renamed and passed to the opcode correctly.
>
> Signed-off-by: Hrvoje Ribicic <[email protected]>
> ---
>  test/py/ganeti.rapi.rlib2_unittest.py | 34
> ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/test/py/ganeti.rapi.rlib2_unittest.py b/test/py/
> ganeti.rapi.rlib2_unittest.py
> index 7bb7a6e..d31aae9 100755
> --- a/test/py/ganeti.rapi.rlib2_unittest.py
> +++ b/test/py/ganeti.rapi.rlib2_unittest.py
> @@ -1588,6 +1588,40 @@ class TestGroupModify(unittest.TestCase):
>      self.assertFalse(hasattr(op, "dry_run"))
>      self.assertRaises(IndexError, cl.GetNextSubmittedJob)
>
> +  def testCustomParamRename(self):
> +    clfactory = _FakeClientFactory(_FakeClient)
> +
> +    name = "groupie"
> +    data = {
> +      "custom_diskparams": {},
> +      "custom_ipolicy": {},
> +      "custom_ndparams": {},
> +      }
> +
> +    handler = _CreateHandler(rlib2.R_2_groups_name_modify, [name], {},
> data,
> +                             clfactory)
> +    job_id = handler.PUT()
> +
> +    cl = clfactory.GetNextClient()
> +    self.assertRaises(IndexError, clfactory.GetNextClient)
> +
> +    (exp_job_id, (op, )) = cl.GetNextSubmittedJob()
> +    self.assertEqual(job_id, exp_job_id)
> +
> +    self.assertTrue(isinstance(op, opcodes.OpGroupSetParams))
> +    self.assertEqual(op.diskparams, {})
> +    self.assertEqual(op.ipolicy, {})
> +    self.assertEqual(op.ndparams, {})
> +
> +    self.assertRaises(IndexError, cl.GetNextSubmittedJob)
> +
> +    # Define both
> +    data["diskparams"] = {}
> +    assert "diskparams" in data and "custom_diskparams" in data
> +    handler = _CreateHandler(rlib2.R_2_groups_name_modify, [name], {},
> data,
> +                             clfactory)
> +    self.assertRaises(http.HttpBadRequest, handler.PUT)
> +
>
>  class TestGroupAdd(unittest.TestCase):
>    def test(self):
> --
> 1.9.1.423.g4596e3a
>
>


-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to