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
 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>"
 def test_wrong_structure(self):
     assert not registry.handle_aux_progress(
         easy_dict('aux', 'progressDetail'))
 def test_wrong_keys(self):
     assert not registry.handle_aux_progress(easy_dict('foo', 'aux'))
 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>"
 def test_correct_keys(self):
     assert '<status>' == registry.handle_raw_status(easy_dict('status'))
 def test_wrong_keys(self):
     assert registry.handle_raw_status(easy_dict('status', 'foo')) is None
 def test_result(self):
     assert "<id>: <status>" == registry.handle_id(easy_dict(
         'id', 'status'))
 def test_error(self):
     self.mock_loads.return_value = easy_dict('error')
     assert "<error>" == self.run_op('a')
 def test_error_detail(self):
     self.mock_loads.return_value = easy_dict('errorDetail')
     assert "<errorDetail>" == self.run_op('a')
 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)
Example #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')