Skip to content

Commit 6a15981

Browse files
committed
Cleanup
1 parent c1b0c8d commit 6a15981

File tree

3 files changed

+1
-88
lines changed

3 files changed

+1
-88
lines changed

linode_api4/groups/lock.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,3 @@ def create(
7070
)
7171

7272
return Lock(self.client, result["id"], result)
73-
74-
def delete(self, lock: Union[Lock, int]) -> bool:
75-
"""
76-
Deletes a Resource Lock.
77-
78-
API Documentation: https://techdocs.akamai.com/linode-api/reference/delete-lock
79-
80-
:param lock: The Lock to delete, or its ID.
81-
:type lock: Lock or int
82-
83-
:returns: True if the lock was successfully deleted.
84-
:rtype: bool
85-
"""
86-
lock_id = lock.id if isinstance(lock, Lock) else lock
87-
88-
self.client.delete(f"/locks/{lock_id}")
89-
return True

test/integration/models/lock/test_lock.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -130,54 +130,6 @@ def test_create_lock_cannot_delete_with_subresources(
130130

131131

132132
def test_delete_lock(test_linode_client, linode_for_lock):
133-
"""
134-
Test that a lock can be deleted.
135-
"""
136-
# Create a lock
137-
lock = test_linode_client.locks.create(
138-
entity_type="linode",
139-
entity_id=linode_for_lock.id,
140-
lock_type=LockType.cannot_delete,
141-
)
142-
143-
lock_id = lock.id
144-
145-
# Delete the lock using the group method
146-
result = test_linode_client.locks.delete(lock)
147-
148-
assert result is True
149-
150-
# Verify the lock no longer exists
151-
locks = test_linode_client.locks()
152-
lock_ids = [lk.id for lk in locks]
153-
assert lock_id not in lock_ids
154-
155-
156-
def test_delete_lock_by_id(test_linode_client, linode_for_lock):
157-
"""
158-
Test that a lock can be deleted by ID.
159-
"""
160-
# Create a lock
161-
lock = test_linode_client.locks.create(
162-
entity_type="linode",
163-
entity_id=linode_for_lock.id,
164-
lock_type=LockType.cannot_delete,
165-
)
166-
167-
lock_id = lock.id
168-
169-
# Delete the lock by ID
170-
result = test_linode_client.locks.delete(lock_id)
171-
172-
assert result is True
173-
174-
# Verify the lock no longer exists
175-
locks = test_linode_client.locks()
176-
lock_ids = [lk.id for lk in locks]
177-
assert lock_id not in lock_ids
178-
179-
180-
def test_lock_object_delete(test_linode_client, linode_for_lock):
181133
"""
182134
Test that a lock can be deleted using the Lock object's delete method.
183135
"""

test/unit/groups/lock_test.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from test.unit.base import ClientBaseCase
22

3-
from linode_api4.objects import Lock, LockType
3+
from linode_api4.objects import LockType
44

55

66
class LockGroupTest(ClientBaseCase):
@@ -78,25 +78,3 @@ def test_create_lock_default_type(self):
7878
)
7979

8080
self.assertEqual(lock.lock_type, "cannot_delete")
81-
82-
def test_delete_lock_by_object(self):
83-
"""
84-
Tests that a lock can be deleted using client.locks.delete() with a Lock object
85-
"""
86-
lock = Lock(self.client, 1)
87-
88-
with self.mock_delete() as m:
89-
result = self.client.locks.delete(lock)
90-
91-
self.assertTrue(result)
92-
self.assertEqual(m.call_url, "/locks/1")
93-
94-
def test_delete_lock_by_id(self):
95-
"""
96-
Tests that a lock can be deleted using client.locks.delete() with an ID
97-
"""
98-
with self.mock_delete() as m:
99-
result = self.client.locks.delete(123)
100-
101-
self.assertTrue(result)
102-
self.assertEqual(m.call_url, "/locks/123")

0 commit comments

Comments
 (0)