Exemplo n.º 1
0
 def get_base_env(self):
     env = easy_dict('BUILD_CODE', 'DOCKER_REPO', 'DOCKER_TAG',
                     'SOURCE_TYPE', 'SOURCE_URL', 'SOURCE_BRANCH',
                     'SOURCE_COMMIT', 'SSH_PRIVATE', 'BUILD_PATH',
                     'DOCKERFILE_PATH', 'DOCKER_HOST', 'DOCKERCFG',
                     'CACHE_TAG', 'SIGNED_URLS', 'BYON', 'PUSH',
                     'PUSH_ATTEMPT_COUNT', 'LOG_BUILD_STEPS',
                     'MAX_LOG_SIZE')
     env.update({
         'PUSH_ATTEMPT_COUNT': 1,
         'MAX_LOG_SIZE': 1,
     })
     return env
Exemplo n.º 2
0
 def test_match(self):
     push_line = {'progressDetail': None, 'aux': easy_dict('foo', 'bar')}
     result = registry.handle_aux_progress(push_line)
     assert result == "  foo: <foo>\n  bar: <bar>"
Exemplo n.º 3
0
 def test_wrong_structure(self):
     assert not registry.handle_aux_progress(
         easy_dict('aux', 'progressDetail'))
Exemplo n.º 4
0
 def test_wrong_keys(self):
     assert not registry.handle_aux_progress(easy_dict('foo', 'aux'))
Exemplo n.º 5
0
 def test_no_prefix(self):
     push_line = easy_dict('id', 'progress')
     push_line['progressDetail'] = easy_dict('current', 'total')
     result = registry.handle_progress(push_line)
     assert result == "<id> Pushing: <progress> <current>/<total>"
Exemplo n.º 6
0
 def test_correct_keys(self):
     assert '<status>' == registry.handle_raw_status(easy_dict('status'))
Exemplo n.º 7
0
 def test_wrong_keys(self):
     assert registry.handle_raw_status(easy_dict('status', 'foo')) is None
Exemplo n.º 8
0
 def test_result(self):
     assert "<id>: <status>" == registry.handle_id(easy_dict(
         'id', 'status'))
Exemplo n.º 9
0
 def test_error(self):
     self.mock_loads.return_value = easy_dict('error')
     assert "<error>" == self.run_op('a')
Exemplo n.º 10
0
 def test_error_detail(self):
     self.mock_loads.return_value = easy_dict('errorDetail')
     assert "<errorDetail>" == self.run_op('a')
Exemplo n.º 11
0
 def test_no_progressdetail(self):
     # TODO make handle_progress actually do something other than raise
     # AttributeError if the struct is malformed
     push_line = easy_dict('id', 'progress')
     with self.assertRaises(AttributeError):
         registry.handle_progress(push_line)
Exemplo n.º 12
0
 def mockUp(self):
     self.mock_fobj = mock.MagicMock()
     self.mock_open.return_value = self.mock_fobj
     self.post_spec = easy_dict('url', 'fields')