def test_create_failed(self):
     client = mock.MagicMock()
     client.create_namespace.side_effect = [
         rest.ApiException(status=500, reason="Test")
     ]
     scenario = namespaces.CreateAndDeleteNamespace()
     scenario.generate_random_name = mock.MagicMock()
     scenario.client = client
     self.assertRaises(rest.ApiException, scenario.run)
     client.create_namespace.assert_called_once_with(None, status_wait=True)
     self.assertEqual(0, client.delete_namespace.call_count)
    def test_create_and_delete_success(self):
        client = mock.MagicMock()
        client.create_namespace.return_value = "a"

        scenario = namespaces.CreateAndDeleteNamespace()
        scenario.generate_random_name = mock.MagicMock()
        scenario.client = client
        scenario.run()

        client.create_namespace.assert_called_once_with(None, status_wait=True)
        client.delete_namespace.assert_called_once_with("a", status_wait=True)