-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiStrings_test.go
83 lines (80 loc) · 3 KB
/
apiStrings_test.go
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
78
79
80
81
82
83
package azrp
import (
"testing"
)
/*
func Test_getPssdString(t *testing.T) {
type args struct {
pdisk string
loc string
cur string
}
tests := []struct {
name string
args args
want string
}{
{"Good", args{"P10", "uksouth", "GBP"},
"https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&CurrencyCode=GBP&$filter=armRegionName%20eq%20%27uksouth%27%20and%20serviceFamily%20eq%20%27Storage%27%20and%20skuName%20eq%20%27P10%20LRS%27%20and%20productName%20eq%20%27Premium%20SSD%20Managed%20Disks%27%20and%20meterName%20eq%20%27P10%20LRS%20Disk%27%20and%20priceType%20eq%20%27Consumption%27"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := getPssdString(tt.args.pdisk, tt.args.loc, tt.args.cur); got != tt.want {
t.Errorf("getPssdString() = %v, want %v", got, tt.want)
}
})
}
}
*/
/*
func Test_getVmString(t *testing.T) {
type args struct {
vm string
loc string
cur string
}
tests := []struct {
name string
args args
want string
}{
{"Good", args{"Standard_D2as_v5", "uksouth", "GBP"},
"https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&CurrencyCode=GBP&$filter=armRegionName%20eq%20%27uksouth%27%20and%20serviceFamily%20eq%20%27Compute%27%20and%20serviceName%20eq%20%27Virtual%20Machines%27%20and%20armSkuName%20eq%20%27Standard_D2as_v5%27"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := getVmString(tt.args.vm, tt.args.loc, tt.args.cur); got != tt.want {
t.Errorf("getVmString() = %v, want %v", got, tt.want)
}
})
}
}
*/
func Test_getSssdStrings(t *testing.T) {
expDisk := "https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&CurrencyCode=GBP&$filter=armRegionName%20eq%20%27uksouth%27%20and%20serviceFamily%20eq%20%27Storage%27%20and%20productName%20eq%20%27Standard%20SSD%20Managed%20Disks%27%20and%20skuName%20eq%20%27E10%20LRS%27%20and%20meterName%20eq%20%27E10%20LRS%20Disk%27%20and%20priceType%20eq%20%27Consumption%27"
expOps := "https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&CurrencyCode=GBP&$filter=armRegionName%20eq%20%27uksouth%27%20and%20serviceFamily%20eq%20%27Storage%27%20and%20productName%20eq%20%27Standard%20SSD%20Managed%20Disks%27%20and%20skuName%20eq%20%27E10%20LRS%27%20and%20meterName%20eq%20%27E10%20LRS%20Disk%20Operations%27%20and%20priceType%20eq%20%27Consumption%27"
type args struct {
sssdName string
region string
currency string
}
tests := []struct {
name string
args args
wantDisk string
wantOps string
}{
{"Good", args{"E10", "uksouth", "GBP"}, expDisk, expOps},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotDisk, gotOps := getSssdStrings(tt.args.sssdName, tt.args.region, tt.args.currency)
if gotDisk != tt.wantDisk {
t.Errorf("getSssdStrings() gotDisk = %v, want %v", gotDisk, tt.wantDisk)
}
if gotOps != tt.wantOps {
t.Errorf("getSssdStrings() gotOps = %v, want %v", gotOps, tt.wantOps)
}
})
}
}