Sha256: 2e506c55358afbec41f472a4b5210b002276b4bd5739b2aeb2e5acd639963367

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

gem 'minitest'

require 'minitest/autorun'
require 'bib/opsworks/google'

class GoogleTest < Minitest::Test

  def test_publish_deployment_user
    google = Bib::Opsworks::Google.new

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

    result = google.prepare_publishing_data(app_name, deploy_data)
    expected = {"deployment[app_name]"=>"unittest", "deployment[user]"=>"gemtest", "deployment[revision]"=>"rev1"}
    assert_equal(expected, result)
  end

  def test_publish_deployment_nouser
    google = Bib::Opsworks::Google.new

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

    result = google.prepare_publishing_data(app_name, deploy_data)
    expected = {"deployment[app_name]"=>"unittest", "deployment[user]"=>"opsworks", "deployment[revision]"=>"rev1"}
    assert_equal(expected, result)
  end

  def test_publish_deployment
   google = Bib::Opsworks::Google.new

    deploy_data = { 'deploying_user' => 'arn:aws:iam::123456:user/gemtest', 'scm' => { 'revision' => 'rev1' } }
    app_name = 'unittest'
    google_ident = 'UA-1869721-12'
    result = google.publish_deployment(app_name, deploy_data, google_ident)
    expected = true
    assert_equal(expected, result)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
BibOpsworks-0.1.2 tests/google_test.rb