Sha256: ef98ec0d6f484cc4721bfd5b7022f5e5c7c797a7bcb343a5866eea55ce41d333

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

gem 'minitest'

require 'minitest/autorun'
require 'bib/opsworks/qafoo'

class QafooTest < Minitest::Test
  def test_publish_deployment_user
    qafoo = Bib::Opsworks::Qafoo.new

    deploy_data = { 'deploying_user' => 'arn:aws:iam::123456:user/gemtest', 'scm' => { 'revision' => 'rev1' } }
    app_name = 'unittest'

    scm_revision = deploy_data['scm']['revision']
    if deploy_data['deploying_user'].nil? || deploy_data['deploying_user'].empty?
      deployment_user = 'opsworks'
    else
      deployment_user = deploy_data['deploying_user'].split('/')[1]
    end
    name_text = "#{scm_revision} by #{deployment_user}"

    result = qafoo.prepare_publishing_data(app_name, deploy_data)
    expected = {
      'name' => name_text,
      'environment' => 'unittest',
      'type' => 'release'
    }
    assert_equal(expected, result)
  end

  def test_publish_deployment_nouser
    qafoo = Bib::Opsworks::Qafoo.new

    deploy_data = { 'scm' => { 'revision' => 'rev1' } }
    app_name = 'unittest'

    scm_revision = deploy_data['scm']['revision']
    if deploy_data['deploying_user'].nil? || deploy_data['deploying_user'].empty?
      deployment_user = 'opsworks'
    else
      deployment_user = deploy_data['deploying_user'].split('/')[1]
    end
    name_text = "#{scm_revision} by #{deployment_user}"

    result = qafoo.prepare_publishing_data(app_name, deploy_data)
    expected = {
      'name' => name_text,
      'environment' => 'unittest',
      'type' => 'release'
    }
    assert_equal(expected, result)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
BibOpsworks-0.1.7 tests/qafoo_test.rb
BibOpsworks-0.1.6 tests/qafoo_test.rb
BibOpsworks-0.1.5 tests/qafoo_test.rb
BibOpsworks-0.1.4 tests/qafoo_test.rb
BibOpsworks-0.1.3 tests/qafoo_test.rb