From f3bd8ac03063c3d4d834d9f6c931e6c4e0bc9b35 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Tue, 21 Jun 2016 14:33:41 -0700 Subject: [PATCH] Add test for util.find_git_parent() Signed-off-by: Dan Mick --- teuthology/suite/test/test_util.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/teuthology/suite/test/test_util.py b/teuthology/suite/test/test_util.py index 0624ed7526..7e7cf1c545 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=[ -- 2.39.5