From: Dan Mick Date: Tue, 21 Jun 2016 21:33:41 +0000 (-0700) Subject: Add test for util.find_git_parent() X-Git-Tag: 1.1.0~595^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F883%2Fhead;p=teuthology.git Add test for util.find_git_parent() Signed-off-by: Dan Mick --- diff --git a/teuthology/suite/test/test_util.py b/teuthology/suite/test/test_util.py index 0624ed752..7e7cf1c54 100644 --- a/teuthology/suite/test/test_util.py +++ b/teuthology/suite/test/test_util.py @@ -117,8 +117,21 @@ class TestUtil(object): assert util.git_ls_remote('ceph', 'nobranch') is None assert util.git_ls_remote('ceph', 'master') is not None + @patch('teuthology.suite.util.requests.get') + def test_find_git_parent(self, m_requests_get): + refresh_resp = Mock() + refresh_resp.ok = True + history_resp = Mock() + history_resp.ok = True + history_resp.json.return_value = {'sha1s': ['sha1', 'sha1_p']} + m_requests_get.side_effect = [refresh_resp, history_resp] + parent_sha1 = util.find_git_parent('ceph', 'sha1') + assert len(m_requests_get.mock_calls) == 2 + assert parent_sha1 == 'sha1_p' + class TestFlavor(object): + def test_get_install_task_flavor_bare(self): config = dict( tasks=[