How to use hokusai - 10 common examples

To help you get started, we’ve selected a few hokusai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github artsy / hokusai / test / utils.py View on Github external
def mock_verbosity(verbosity):
  old_verbosity = get_verbosity()

  set_verbosity(verbosity)
  yield
  set_verbosity(old_verbosity)
github artsy / hokusai / test / unit / test_config.py View on Github external
def test_check_hokusai_required_version(self):
    self.assertTrue(self.config._check_required_version(None, '0.0.1'))
    with self.assertRaises(HokusaiError):
      self.config._check_required_version('0.0.1', '0.0.1')
    with self.assertRaises(HokusaiError):
      self.config._check_required_version('someinvalidversionspecifier', '0.0.1')
    self.assertTrue(self.config._check_required_version('~=0.1', '0.1.1'))
    self.assertTrue(self.config._check_required_version('~=0.1', '0.2'))
    self.assertFalse(self.config._check_required_version('~=0.1', '1.0'))
    self.assertTrue(self.config._check_required_version('==0.0.1', '0.0.1'))
    self.assertFalse(self.config._check_required_version('==0.0.1', '0.0.2'))
    self.assertFalse(self.config._check_required_version('==1.0', '0.2'))
    self.assertTrue(self.config._check_required_version('<0.0.2.post2', '0.0.2.post1'))
    self.assertTrue(self.config._check_required_version('<1.1', '1.0.2'))
    self.assertFalse(self.config._check_required_version('<1.1', '2.0.2'))
    self.assertFalse(self.config._check_required_version('<=0.0.2', '2.2'))
    self.assertTrue(self.config._check_required_version('<=2.2', '2.2'))
    self.assertTrue(self.config._check_required_version('>0.0.1', '1.2.3'))
    self.assertTrue(self.config._check_required_version('>0.0.1.post1', '0.0.1.post3'))
    self.assertTrue(self.config._check_required_version('>=0.0.1', '1.2.3'))
    self.assertTrue(self.config._check_required_version('>=1.2.3', '1.2.3'))
github artsy / hokusai / test / unit / test_common.py View on Github external
def test_shout(self, mocked_check_output):
    with captured_output() as (out, err):
      self.assertEqual(shout('whoami'), 'hokusai')
      mocked_check_output.assert_called_once_with('whoami', shell=True, stderr=-2)
github artsy / hokusai / test / unit / test_common.py View on Github external
def test_print_green(self):
    with captured_output() as (out, err):
      print_green(TEST_MESSAGE)
      self.assertEqual(out.getvalue().strip(), "\x1b[32m%s\x1b[0m" % TEST_MESSAGE)
github artsy / hokusai / test / unit / test_config.py View on Github external
def test_config_from_file(self):
    self.assertEqual(config.config.project_name, 'hello')
    self.assertEqual(config.config.pre_deploy, 'migrate.sh')
    self.assertEqual(config.config.post_deploy, 'sh -c report.sh')
    self.assertEqual(config.config.git_remote, 'git@github.com:artsy/hokusai.git')
    self.assertEqual(config.config.template_config_file, './test/fixtures/template_config.yml')
github artsy / hokusai / test / unit / test_config.py View on Github external
def test_config_from_file(self):
    self.assertEqual(config.config.project_name, 'hello')
    self.assertEqual(config.config.pre_deploy, 'migrate.sh')
    self.assertEqual(config.config.post_deploy, 'sh -c report.sh')
    self.assertEqual(config.config.git_remote, 'git@github.com:artsy/hokusai.git')
    self.assertEqual(config.config.template_config_file, './test/fixtures/template_config.yml')
github artsy / hokusai / test / unit / test_config.py View on Github external
def test_config_from_file(self):
    self.assertEqual(config.config.project_name, 'hello')
    self.assertEqual(config.config.pre_deploy, 'migrate.sh')
    self.assertEqual(config.config.post_deploy, 'sh -c report.sh')
    self.assertEqual(config.config.git_remote, 'git@github.com:artsy/hokusai.git')
    self.assertEqual(config.config.template_config_file, './test/fixtures/template_config.yml')
github artsy / hokusai / test / unit / test_config_loader.py View on Github external
def test_load_config(self):
    _config_file = os.path.join(CWD, 'test/fixtures/template_config.yml')
    config_loader = ConfigLoader(_config_file)
    template_config = config_loader.load()
    self.assertEqual("eggs", template_config["vars"]["imageTag"])
github artsy / hokusai / test / unit / test_docker_compose_helpers.py View on Github external
def test_follows_extends(self):
    httpretty.register_uri(httpretty.POST, "https://sts.amazonaws.com/",
                            body=open(os.path.join(os.getcwd(), 'test', 'fixtures', 'sts-get-caller-identity-response.xml')).read(),
                            content_type="application/xml")
    httpretty.register_uri(httpretty.POST, "https://api.ecr.us-east-1.amazonaws.com/",
                            body=open(os.path.join(os.getcwd(), 'test', 'fixtures', 'ecr-repositories-response.json')).read(),
                            content_type="application/x-amz-json-1.1")
    docker_compose_yml = os.path.join(CWD, 'test/fixtures/project/hokusai/docker-compose-extends.yml.j2')
    rendered_templates = docker_compose_helpers.follow_extends(docker_compose_yml)
    self.assertEqual(len(rendered_templates), 1)

    with open(rendered_templates[0], 'r') as f:
      struct = yaml.safe_load(f.read())
      self.assertEqual(struct['services']['nancy']['build']['context'], '../')
github artsy / hokusai / test / unit / test_template_selector.py View on Github external
def setUp(self):
    self.template_path = os.path.join(CWD, 'test/fixtures/project/hokusai')