Skip to content

Commit ac76823

Browse files
committed
Create unit tests for locking and unlocking an issue
1 parent 01f7225 commit ac76823

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/unit/test_issues_issue.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ def test_edit_comment(self):
6666
with pytest.raises(github3.AuthenticationFailed):
6767
self.instance.edit()
6868

69+
def test_lock(self):
70+
"""Verify that locking an issue requires authentication."""
71+
with pytest.raises(github3.AuthenticationFailed):
72+
self.instance.lock()
73+
6974
def test_remove_all_labels(self):
7075
"""Verify that removing all labels requires authentication."""
7176
with pytest.raises(github3.AuthenticationFailed):
@@ -81,6 +86,11 @@ def test_reopen(self):
8186
with pytest.raises(github3.AuthenticationFailed):
8287
self.instance.reopen()
8388

89+
def test_unlock(self):
90+
"""Verify that unlocking an issue requires authentication."""
91+
with pytest.raises(github3.AuthenticationFailed):
92+
self.instance.unlock()
93+
8494

8595
class TestIssue(helper.UnitHelper):
8696

@@ -156,6 +166,15 @@ def test_create_comment_required_body(self):
156166
self.instance.create_comment(body='')
157167
assert self.session.post.called is False
158168

169+
def test_create_lock(self):
170+
"""Verify the request for removing a lock from an issue."""
171+
self.instance.lock()
172+
173+
self.session.put.assert_called_once_with(
174+
url_for('lock'),
175+
headers={'Accept': 'application/vnd.github.the-key-preview+json'}
176+
)
177+
159178
def test_comment_positive_id(self):
160179
"""Verify the request for retrieving an issue comment."""
161180
self.instance.comment(-1)
@@ -267,6 +286,15 @@ def test_remove_label(self):
267286
url_for('labels/enhancement')
268287
)
269288

289+
def test_remove_lock(self):
290+
"""Verify the request for removing a lock from an issue."""
291+
self.instance.unlock()
292+
293+
self.session.delete.assert_called_once_with(
294+
url_for('lock'),
295+
headers={'Accept': 'application/vnd.github.the-key-preview+json'}
296+
)
297+
270298
def test_reopen(self):
271299
"""Test the request for reopening an issue."""
272300
labels = [str(label) for label in self.instance.original_labels]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy