Ejemplo n.º 1
0
 def test_get_hash_success(self, m_get):
     mock_resp = Mock()
     mock_resp.ok = True
     mock_resp.text = "the_hash"
     m_get.return_value = mock_resp
     result = util.get_gitbuilder_hash()
     assert result == "the_hash"
Ejemplo n.º 2
0
 def test_get_hash_success(self, m_get):
     mock_resp = Mock()
     mock_resp.ok = True
     mock_resp.text = "the_hash"
     m_get.return_value = mock_resp
     result = util.get_gitbuilder_hash()
     assert result == "the_hash"
Ejemplo n.º 3
0
 def choose_kernel(self):
     # Put together a stanza specifying the kernel hash
     if self.args.kernel_branch == 'distro':
         kernel_hash = 'distro'
     # Skip the stanza if '-k none' is given
     elif self.args.kernel_branch is None or \
          self.args.kernel_branch.lower() == 'none':
         kernel_hash = None
     else:
         kernel_hash = util.get_gitbuilder_hash(
             'kernel',
             self.args.kernel_branch,
             'default',
             self.args.machine_type,
             self.args.distro,
             self.args.distro_version,
         )
         if not kernel_hash:
             util.schedule_fail("Kernel branch '{branch}' not found".format(
                 branch=self.args.kernel_branch))
     if kernel_hash:
         log.info("kernel sha1: {hash}".format(hash=kernel_hash))
         kernel_dict = dict(kernel=dict(kdb=True, sha1=kernel_hash))
         if kernel_hash != 'distro':
             kernel_dict['kernel']['flavor'] = 'default'
     else:
         kernel_dict = dict()
     return kernel_dict
Ejemplo n.º 4
0
 def test_get_hash_fail(self, m_get):
     mock_resp = Mock()
     mock_resp.ok = False
     m_get.return_value = mock_resp
     result = util.get_gitbuilder_hash()
     assert result is None
Ejemplo n.º 5
0
 def test_get_hash_fail(self, m_get):
     mock_resp = Mock()
     mock_resp.ok = False
     m_get.return_value = mock_resp
     result = util.get_gitbuilder_hash()
     assert result is None