Skip to content

Commit 2fb204c

Browse files
committed
Fix tests
1 parent 72b4f13 commit 2fb204c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

test/integration/models/lock/test_lock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_delete_lock(test_linode_client, linode_for_lock):
149149

150150
# Verify the lock no longer exists
151151
locks = test_linode_client.locks()
152-
lock_ids = [l.id for l in locks]
152+
lock_ids = [lk.id for lk in locks]
153153
assert lock_id not in lock_ids
154154

155155

@@ -173,7 +173,7 @@ def test_delete_lock_by_id(test_linode_client, linode_for_lock):
173173

174174
# Verify the lock no longer exists
175175
locks = test_linode_client.locks()
176-
lock_ids = [l.id for l in locks]
176+
lock_ids = [lk.id for lk in locks]
177177
assert lock_id not in lock_ids
178178

179179

@@ -195,5 +195,5 @@ def test_lock_object_delete(test_linode_client, linode_for_lock):
195195

196196
# Verify the lock no longer exists
197197
locks = test_linode_client.locks()
198-
lock_ids = [l.id for l in locks]
198+
lock_ids = [lk.id for lk in locks]
199199
assert lock_id not in lock_ids

test/unit/groups/lock_test.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,22 @@ def test_create_lock_with_subresources(self):
6262
m.call_data["lock_type"], "cannot_delete_with_subresources"
6363
)
6464

65+
self.assertEqual(lock.id, 1)
66+
self.assertEqual(lock.lock_type, "cannot_delete")
67+
self.assertIsNotNone(lock.entity)
68+
self.assertEqual(lock.entity.id, 123)
69+
6570
def test_create_lock_default_type(self):
6671
"""
6772
Tests that creating a lock without specifying lock_type uses cannot_delete
6873
"""
69-
with self.mock_post("/locks/1") as m:
70-
self.client.locks.create(
74+
with self.mock_post("/locks/1"):
75+
lock = self.client.locks.create(
7176
entity_type="linode",
7277
entity_id=123,
7378
)
7479

75-
self.assertEqual(m.call_data["lock_type"], "cannot_delete")
80+
self.assertEqual(lock.lock_type, "cannot_delete")
7681

7782
def test_delete_lock_by_object(self):
7883
"""

0 commit comments

Comments
 (0)