github.com/sacloud/iaas-api-go@v1.12.0/accessor_test.go (about) 1 // Copyright 2022-2023 The sacloud/iaas-api-go Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package iaas 16 17 import ( 18 "testing" 19 20 "github.com/sacloud/iaas-api-go/accessor" 21 ) 22 23 func TestAccessor(t *testing.T) { 24 var v interface{} 25 26 v = &Archive{} 27 if _, ok := v.(accessor.Tags); !ok { 28 t.Fatal("target is not implements accessor.Tags") 29 } 30 31 v = &Server{} 32 if _, ok := v.(accessor.ID); !ok { 33 t.Fatal("target is not implements accessor.ID") 34 } 35 if _, ok := v.(accessor.Availability); !ok { 36 t.Fatal("target is not implements accessor.Availability") 37 } 38 if _, ok := v.(accessor.CreatedAt); !ok { 39 t.Fatal("target is not implements accessor.CreatedAt") 40 } 41 if _, ok := v.(accessor.ModifiedAt); !ok { 42 t.Fatal("target is not implements accessor.ModifiedAt") 43 } 44 if _, ok := v.(accessor.Instance); !ok { 45 t.Fatal("target is not implements accessor.Instance") 46 } 47 if _, ok := v.(accessor.InstanceStatus); !ok { 48 t.Fatal("target is not implements accessor.InstanceStatus") 49 } 50 if _, ok := v.(accessor.MemoryMB); !ok { 51 t.Fatal("target is not implements accessor.MemoryMB") 52 } 53 54 v = &Disk{} 55 if _, ok := v.(accessor.DiskMigratable); !ok { 56 t.Fatal("target is not implements accessor.DiskMigratable") 57 } 58 if _, ok := v.(accessor.DiskPlan); !ok { 59 t.Fatal("target is not implements accessor.DiskPlan") 60 } 61 if _, ok := v.(accessor.SizeMB); !ok { 62 t.Fatal("target is not implements accessor.SizeMB") 63 } 64 if _, ok := v.(accessor.MigratedMB); !ok { 65 t.Fatal("target is not implements accessor.MigratedMB") 66 } 67 68 v = &Note{} 69 if _, ok := v.(accessor.Scope); !ok { 70 t.Fatal("target is not implements accessor.Scope") 71 } 72 }