示例#1
0
 def test__get_latest_version_Should_ReturnExpected_When_NoTagFound(
         self, read_page_patch, lookup_tag_patch, get_version_patch,
         *patches):
     read_page_patch.return_value = [{
         'sha': '-sha1-'
     }, {
         'sha': '-sha2-'
     }, {
         'sha': '-sha3-'
     }]
     lookup_tag_patch.side_effect = [None, None, None]
     client = GitHubAPI('api.github.com', bearer_token='bearer-token')
     tags = ['tag1', 'tag2']
     result = client.get_latest_version(repo='soda480/repo1', tags=tags)
     self.assertEqual(result, (None, None))
示例#2
0
 def test__get_latest_version_Should_CallAndReturnExpected_When_Called(
         self, read_page_patch, lookup_tag_patch, get_version_patch,
         *patches):
     read_page_patch.return_value = [{
         'sha': '-sha1-'
     }, {
         'sha': '-sha2-'
     }, {
         'sha': '-sha3-'
     }]
     client = GitHubAPI('api.github.com', bearer_token='bearer-token')
     tags = ['tag1', 'tag2']
     result = client.get_latest_version(repo='soda480/repo1', tags=tags)
     self.assertEqual(result, (get_version_patch.return_value, '-sha1-'))
     read_page_patch.assert_called_once_with(
         '/repos/soda480/repo1/commits?sha=master')
     lookup_tag_patch.assert_called_with(tags=tags, sha='-sha1-')