8000 Be more concise and explicit in protection related tests. · pythonthings/github3.py@9aa1f00 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 9aa1f00

Browse filesBrowse files
committed
Be more concise and explicit in protection related tests.
1 parent 8b08953 commit 9aa1f00

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

tests/integration/test_repos_repo.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_branch(self):
3737
assert repository is not None
3838
branch = repository.branch('develop')
3939
assert isinstance(branch, github3.repos.branch.Branch)
40-
assert branch.protection['enabled']
40+
assert 'enabled' in branch.protection
4141

4242
def test_branches(self):
4343
"""Test the ability to retrieve the branches in a repository."""
@@ -54,11 +54,8 @@ def test_protected_branches(self):
5454
with self.recorder.use_cassette(cassette_name):
5555
repository = self.gh.repository('sigmavirus24', 'github3.py')
5656
assert repository is not None
57-
found = False
58-
for branch in repository.branches(protected=True):
59-
assert branch.protection['enabled']
60-
found = True
61-
assert found
57+
assert all(b.protection['enabled'] is True
58+
for b in repository.branches(protected=True))
6259

6360
def test_code_frequency(self):
6461
"""Test the ability to retrieve the code frequency in a repo."""

tests/test_repos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_branch(self):
8585

8686
b = self.repo.branch('master')
8787
assert isinstance(b, repos.branch.Branch)
88-
assert b.protection
88+
assert 'enabled' in b.protection
8989
self.mock_assertions()
9090

9191
assert repr(b) == '<Repository Branch [master]>'

0 commit comments

Comments
 (0)
0