[lxc-devel] [pylxd/master] Remove `Profile.rename` code; add a test

rockstar on Github lxc-bot at linuxcontainers.org
Sun May 29 05:29:53 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160529/225e1357/attachment.bin>
-------------- next part --------------
From 2744ab828502321ce119f3f471f35725b572fd62 Mon Sep 17 00:00:00 2001
From: Paul Hummer <paul at eventuallyanyway.com>
Date: Sat, 28 May 2016 23:30:14 -0600
Subject: [PATCH] Remove `Profile.rename` code; add a test

---
 pylxd/profile.py            | 2 --
 pylxd/tests/test_profile.py | 7 +++++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pylxd/profile.py b/pylxd/profile.py
index ede9c17..fbcc902 100644
--- a/pylxd/profile.py
+++ b/pylxd/profile.py
@@ -75,8 +75,6 @@ def rename(self, new):
         """Rename the profile."""
         raise NotImplementedError(
             'LXD does not currently support renaming profiles')
-        self._client.api.profiles[self.name].post(json={'name': new})
-        self.name = new
 
     def delete(self):
         """Delete a profile."""
diff --git a/pylxd/tests/test_profile.py b/pylxd/tests/test_profile.py
index 689e5e4..a3a5b98 100644
--- a/pylxd/tests/test_profile.py
+++ b/pylxd/tests/test_profile.py
@@ -46,6 +46,13 @@ def test_create(self):
         self.assertIsInstance(an_profile, profile.Profile)
         self.assertEqual('an-new-profile', an_profile.name)
 
+    def test_rename(self):
+        """Profiles cannot yet be renamed."""
+        an_profile = profile.Profile.get(self.client, 'an-profile')
+
+        self.assertRaises(
+            NotImplementedError, an_profile.rename, 'an-renamed-profile')
+
     def test_create_failed(self):
         """CreateFailed is raised when errors occur."""
         def error(request, context):


More information about the lxc-devel mailing list