Пример #1
0
 def test_authenticate_valid_credentials(self, m):
     response = mock.Mock()
     response.status_code = 200
     response.text = GITHUB_VALID_RESPONSE
     m.return_value = response
     result = authenticate_github(USERNAME, PASSWORD)
     self.assertEqual(result['login'], GITHUB_VALID_RESPONSE_DATA['login'])
     self.assertEqual(result['avatar_url'], GITHUB_VALID_RESPONSE_DATA['avatar_url'])
Пример #2
0
 def test_authenticate_invalid_credentials(self, m):
     m.side_effect = RequestException()
     result = authenticate_github(USERNAME, PASSWORD)
     self.assertFalse(result)
Пример #3
0
 def test_authenticate_invalid_credentials(self, m):
     response = mock.Mock()
     response.status_code = 401
     m.return_value = response
     result = authenticate_github(USERNAME, PASSWORD)
     self.assertFalse(result)