LGTM, thanks.

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

> The get/put QA test could be used for instances as well, but unlike
> other objects, instances have a very large number of discrepancies and
> missing fields. To avoid enumerating every discrepancy and testing
> almost nothing, only a unit test is used to verify the last patch.
>
> Signed-off-by: Hrvoje Ribicic <[email protected]>
> ---
>  test/py/ganeti.rapi.rlib2_unittest.py | 36
> +++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/test/py/ganeti.rapi.rlib2_unittest.py b/test/py/
> ganeti.rapi.rlib2_unittest.py
> index d31aae9..ba0ac62 100755
> --- a/test/py/ganeti.rapi.rlib2_unittest.py
> +++ b/test/py/ganeti.rapi.rlib2_unittest.py
> @@ -558,6 +558,42 @@ class TestInstanceDiskGrow(unittest.TestCase):
>      self.assertRaises(IndexError, cl.GetNextSubmittedJob)
>
>
> +class TestInstanceModify():
> +  def testCustomParamRename(self):
> +    clfactory = _FakeClientFactory(_FakeClient)
> +
> +    name = "instant_instance"
> +    data = {
> +      "custom_beparams": {},
> +      "custom_hvparams": {},
> +      "custom_nicparams": {},
> +      }
> +
> +    handler = _CreateHandler(rlib2.R_2_instances_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.OpInstanceSetParams))
> +    self.assertEqual(op.beparams, {})
> +    self.assertEqual(op.hvparams, {})
> +    self.assertEqual(op.nicparams, {})
> +
> +    self.assertRaises(IndexError, cl.GetNextSubmittedJob)
> +
> +    # Define both
> +    data["beparams"] = {}
> +    assert "beparams" in data and "custom_beparams" in data
> +    handler = _CreateHandler(rlib2.R_2_instances_name_modify, [name], {},
> data,
> +                             clfactory)
> +    self.assertRaises(http.HttpBadRequest, handler.PUT)
> +
> +
>  class TestBackupPrepare(unittest.TestCase):
>    def test(self):
>      clfactory = _FakeClientFactory(_FakeClient)
> --
> 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