File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919example_data = get_users_example_data ()
2020
2121
22+ class TestUserKeyRequiresAuth (UnitHelper ):
23+
24+ """Test that ensure certain methods on Key class requires auth."""
25+
26+ described_class = github3 .users .Key
27+ example_data = get_user_key_example_data ()
28+
29+ """Test Key methods that require authentication."""
30+ def after_setup (self ):
31+ self .session .has_auth .return_value = False
32+
33+ def test_update (self ):
34+ """Test that updating a key requires authentication."""
35+ with pytest .raises (github3 .AuthenticationFailed ):
36+ self .instance .update (title = 'New Title' , key = 'Fake key' )
37+
38+ def test_delete (self ):
39+ """Test that deleting a key requires authentication."""
40+ with pytest .raises (github3 .AuthenticationFailed ):
41+ self .instance .delete ()
42+
43+
2244class TestUserKey (UnitHelper ):
45+
46+ """Test methods on Key class."""
47+
2348 described_class = github3 .users .Key
2449 example_data = get_user_key_example_data ()
2550
@@ -39,7 +64,7 @@ def test_repr(self):
3964 def test_delete (self ):
4065 """Test the request for deleting key."""
4166 self .instance .delete ()
42- assert self .session .delete .called
67+ assert self .session .delete .called is True
4368
4469 def test_update (self ):
4570 """Test the request for updating a key."""
You can’t perform that action at this time.
0 commit comments