def test_get_hash_fail(self, m_get, m_get_gitbuilder_url): m_get_gitbuilder_url.return_value = "http://baseurl.com" mock_resp = Mock() mock_resp.ok = False m_get.return_value = mock_resp result = suite.get_hash() assert result is None
def test_get_hash_success(self, m_get, m_get_gitbuilder_url): m_get_gitbuilder_url.return_value = "http://baseurl.com" mock_resp = Mock() mock_resp.ok = True mock_resp.text = "the_hash" m_get.return_value = mock_resp result = suite.get_hash() m_get.assert_called_with("http://baseurl.com/ref/master/sha1") assert result == "the_hash"
def test_ceph_hash(self): resp = requests.get( 'https://api.github.com/repos/ceph/ceph/git/refs/heads/master') ref_hash = resp.json()['object']['sha'] assert suite.get_hash('ceph') == ref_hash
def test_kernel_hash_saya(self): # We don't currently have these packages. assert suite.get_hash('kernel', 'master', 'basic', 'saya') is None
def test_kernel_hash_saya(self): # We don't currently have these packages. assert suite.get_hash('kernel', 'master', 'default', 'saya') is None
def test_ceph_hash_simple(self): resp = requests.get( 'https://api.github.com/repos/ceph/ceph/git/refs/heads/master') ref_hash = resp.json()['object']['sha'] assert suite.get_hash('ceph') == ref_hash