File: recordset_tests.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (77 lines) | stat: -rw-r--r-- 2,241 bytes parent folder | download
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
67
68
69
70
71
72
73
74
75
76
77
require "test_helper"
require "helpers/dns_v2_helper"

describe "Fog::OpenStack::DNS::V2 | recordset requests" do
  before do
    @dns, @zone, @zone_id = set_dns_data

    @recordset = @dns.create_recordset(@zone_id, 'test.example.org', 'A', ['10.0.0.1'])

    @recordset_format = {
      "description" => String,
      "links"       => Hash,
      "updated_at"  => String,
      "records"     => Array,
      "ttl"         => Integer,
      "id"          => String,
      "name"        => String,
      "project_id"  => String,
      "zone_id"     => String,
      "zone_name"   => String,
      "created_at"  => String,
      "version"     => Integer,
      "type"        => String,
      "status"      => String,
      "action"      => String
    }

    recordset_links_format = {
      "self" => String,
      "next" => String
    }

    recordset_metadata_format = {
      "total_count" => Integer
    }

    @recordset_list_format = {
      "recordsets" => [@recordset_format],
      "links"      => recordset_links_format,
      "metadata"   => recordset_metadata_format
    }
  end

  describe "success" do
    it "#list_recordsets deprecated" do
      recordset_list_body = @dns.list_recordsets(@zone_id).body
      recordset_list_body.must_match_schema(@recordset_list_format)
      recordset_list_body['recordsets'].sample['zone_id'].must_equal(@zone_id)
    end

    it "#list_recordsets" do
      recordset_list_body = @dns.list_recordsets(:zone_id => @zone_id).body
      recordset_list_body.must_match_schema(@recordset_list_format)
      recordset_list_body['recordsets'].sample['zone_id'].must_equal(@zone_id)
    end

    it "#create_recordset" do
      @recordset.body.must_match_schema(@recordset_format)
    end

    it "#get_recordset" do
      @dns.get_recordset(@zone_id, @recordset.body['id']).body.must_match_schema(@recordset_format)
    end

    it "#update_recordset" do
      @dns.update_recordset(
        @zone_id,
        @recordset.body['id'],
        "email" => 'new_hostmaster@test.example.org'
      ).body.must_match_schema(@recordset_format)
    end

    it "#delete_recordset" do
      @dns.delete_recordset(@zone_id, @recordset.body['id']).body.must_match_schema(@recordset_format)
    end
  end
end