File: version_tests.rb

package info (click to toggle)
ruby-fog-aws 3.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,140 kB
  • sloc: ruby: 73,328; javascript: 14; makefile: 9; sh: 4
file content (66 lines) | stat: -rw-r--r-- 1,855 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Shindo.tests("Fog::AWS[:beanstalk] | version", ['aws', 'beanstalk']) do

  pending if Fog.mocking?

  @beanstalk = Fog::AWS[:beanstalk]

  @application_name = uniq_id('fog-test-app')
  @version_name = uniq_id('fog-test-version')

  @version_description = 'A nice description'

  @application = @beanstalk.applications.create({:name => @application_name})

  @version_opts = {
      :application_name => @application_name,
      :label => @version_name,
      :description => @version_description
  }

  model_tests(@beanstalk.versions, @version_opts, false) do

    test("attributes") do
      @instance.label == @version_name &&
          @instance.description == @version_description &&
          @instance.application_name == @application_name
    end

    test("#events") do
      # There should be some events now.
      @instance.events.length > 0
    end

    test("#update description") do
      new_description = "A completely new description."
      @instance.description = new_description
      @instance.update

      passed = false
      if @instance.description == new_description
        # reload version from AWS to verify save is committed to server, not just on local object
        if @beanstalk.versions.get(@application_name, @version_name).description == new_description
          passed = true
        end
      end
      passed
    end

    test("#update description empty") do
      @instance.description = '' # Set to empty to nil out
      @instance.update

      passed = false
      if @instance.description == nil
        # reload version from AWS to verify save is committed to server, not just on local object
        if @beanstalk.versions.get(@application_name, @version_name).description == nil
          passed = true
        end
      end
      passed
    end

  end

  # delete application
  @application.destroy
end