|
| 1 | +Shindo.tests('Linode | linode requests', ['linode']) do |
| 2 | + |
| 3 | + @linode_format = Linode::Formats::BASIC.merge({ |
| 4 | + 'DATA' => { 'LinodeID' => Integer } |
| 5 | + }) |
| 6 | + |
| 7 | + @linodes_format = Linode::Formats::BASIC.merge({ |
| 8 | + 'DATA' => [{ |
| 9 | + 'ALERT_BWIN_ENABLED' => Integer, |
| 10 | + 'ALERT_CPU_THRESHOLD' => Integer, |
| 11 | + 'ALERT_BWOUT_ENABLED' => Integer, |
| 12 | + 'ALERT_BWOUT_THRESHOLD' => Integer, |
| 13 | + 'ALERT_BWQUOTA_ENABLED' => Integer, |
| 14 | + 'ALERT_BWQUOTA_THRESHOLD' => Integer, |
| 15 | + 'ALERT_BWIN_THRESHOLD' => Integer, |
| 16 | + 'ALERT_CPU_ENABLED' => Integer, |
| 17 | + 'ALERT_DISKIO_ENABLED' => Integer, |
| 18 | + 'ALERT_DISKIO_THRESHOLD' => Integer, |
| 19 | + 'BACKUPSENABLED' => Integer, |
| 20 | + 'BACKUPWEEKLYDAY' => Integer, |
| 21 | + 'BACKUPWINDOW' => Integer, |
| 22 | + 'DATACENTERID' => Integer, |
| 23 | + 'LABEL' => String, |
| 24 | + 'LINODEID' => Integer, |
| 25 | + 'LPM_DISPLAYGROUP' => String, |
| 26 | + 'STATUS' => Integer, |
| 27 | + 'TOTALHD' => Integer, |
| 28 | + 'TOTALRAM' => Integer, |
| 29 | + 'TOTALXFER' => Integer, |
| 30 | + 'WATCHDOG' => Integer, |
| 31 | + }] |
| 32 | + }) |
| 33 | + |
| 34 | + @reboot_format = Linode::Formats::BASIC.merge({ |
| 35 | + 'DATA' => { 'JobID' => Integer } |
| 36 | + }) |
| 37 | + |
| 38 | + tests('success') do |
| 39 | + |
| 40 | + @linode_id = nil |
| 41 | + |
| 42 | + # (2 => Dallas, TX, USA), (1 => 1 month), (1 => Linode 512) |
| 43 | + tests('#linode_create(2, 1, 1)').formats(@linode_format) do |
| 44 | + data = Linode[:linode].linode_create(2, 1, 1).body |
| 45 | + @linode_id = data['DATA']['LinodeID'] |
| 46 | + data |
| 47 | + end |
| 48 | + |
| 49 | + tests("#linode_list(#{@linode_id})").formats(@linodes_format) do |
| 50 | + Linode[:linode].linode_list(@linode_id).body |
| 51 | + end |
| 52 | + |
| 53 | + tests('#linode_list').formats(@linodes_format) do |
| 54 | + Linode[:linode].linode_list.body |
| 55 | + end |
| 56 | + |
| 57 | + # tests("#linode_reboot(#{@linode_id})").formats(@reboot_format) do |
| 58 | + # Linode[:linode].linode_reboot(@linode_id).body |
| 59 | + # end |
| 60 | + |
| 61 | + tests('#linode_delete(#{@linode_id})').succeeds do |
| 62 | + Linode[:linode].linode_delete(@linode_id) |
| 63 | + end |
| 64 | + |
| 65 | + end |
| 66 | + |
| 67 | + tests('failure') do |
| 68 | + |
| 69 | + tests('#linode_reboot(0)').raises(Fog::Linode::NotFound) do |
| 70 | + Linode[:linode].linode_reboot(0) |
| 71 | + end |
| 72 | + |
| 73 | + tests('#linode_delete(0)').raises(Fog::Linode::NotFound) do |
| 74 | + Linode[:linode].linode_delete(0) |
| 75 | + end |
| 76 | + |
| 77 | + end |
| 78 | + |
| 79 | +end |
0 commit comments