Esempio 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"
Esempio 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"
Esempio 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
Esempio 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
Esempio 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