]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add test for util.find_git_parent() 883/head
authorDan Mick <dan.mick@redhat.com>
Tue, 21 Jun 2016 21:33:41 +0000 (14:33 -0700)
committerDan Mick <dan.mick@redhat.com>
Thu, 23 Jun 2016 21:17:24 +0000 (14:17 -0700)
Signed-off-by: Dan Mick <dan.mick@redhat.com>
teuthology/suite/test/test_util.py

index 0624ed75260e8b5f69c3bbbbb46be1085ae440f2..7e7cf1c545be99bd64dc7a7eeb00d3cd5eafb1fa 100644 (file)
@@ -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=[