| 1 | package pathsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 5 | |
| 6 | "github.com/Azure/go-autorest/autorest/azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/" |
| 7 | ) |
| 8 | |
| 9 | func TestGetResourceIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/TestGetResourceID().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 10 | testData := []struct { |
| 11 | AccountName string |
| 12 | FileSystemName string |
| 13 | Path string |
| 14 | Expected string |
| 15 | }{ |
| 16 | { |
| 17 | AccountName: "account1", |
| 18 | FileSystemName: "fs1", |
| 19 | Path: "test", |
| 20 | Expected: "https://account1.dfs.core.windows.net/fs1/test", |
| 21 | }, |
| 22 | { |
| 23 | AccountName: "account1", |
| 24 | FileSystemName: "fs1", |
| 25 | Path: "test/test2", |
| 26 | Expected: "https://account1.dfs.core.windows.net/fs1/test/test2", |
| 27 | }, |
| 28 | { |
| 29 | AccountName: "account1", |
| 30 | FileSystemName: "fs1", |
| 31 | Path: "", |
| 32 | Expected: "https://account1.dfs.core.windows.net/fs1/", |
| 33 | }, |
| 34 | } |
| 35 | for _, v := range testData { |
| 36 | t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Testing Path %q", v.Path) |
| 37 | c := NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/NewWithEnvironment().(azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.PublicCloudscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/PublicCloud.) |
| 38 | actual := c.GetResourceIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#GetResourceID().(v.AccountName, v.FileSystemName, v.Path) |
| 39 | if actual != v.Expected { |
| 40 | t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected the Resource ID to be %q but got %q", v.Expected, actual) |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | func TestParseResourceIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/TestParseResourceID().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 46 | testData := []struct { |
| 47 | Input string |
| 48 | AccountName string |
| 49 | FileSystemName string |
| 50 | Path string |
| 51 | }{ |
| 52 | { |
| 53 | Input: "https://account1.dfs.core.windows.net/fs1/test", |
| 54 | AccountName: "account1", |
| 55 | FileSystemName: "fs1", |
| 56 | Path: "test", |
| 57 | }, |
| 58 | { |
| 59 | Input: "https://account1.dfs.core.windows.net/fs1/test/test2", |
| 60 | AccountName: "account1", |
| 61 | FileSystemName: "fs1", |
| 62 | Path: "test/test2", |
| 63 | }, |
| 64 | { |
| 65 | Input: "https://account1.dfs.core.windows.net/fs1/", |
| 66 | AccountName: "account1", |
| 67 | FileSystemName: "fs1", |
| 68 | Path: "", |
| 69 | }, |
| 70 | } |
| 71 | for _, v := range testData { |
| 72 | t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Testing Path %q", v.Path) |
| 73 | actual, err := ParseResourceIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ParseResourceID().(v.Input) |
| 74 | if err != nil { |
| 75 | t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err) |
| 76 | } |
| 77 | |
| 78 | if actual.AccountNamescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ResourceID#AccountName. != v.AccountName { |
| 79 | t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected the account name to be `%q` but got %q", v.AccountName, actual.AccountNamescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ResourceID#AccountName.) |
| 80 | } |
| 81 | |
| 82 | if actual.FileSystemNamescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ResourceID#FileSystemName. != v.FileSystemName { |
| 83 | t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected the file system name to be `%q` but got %q", v.FileSystemName, actual.FileSystemNamescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ResourceID#FileSystemName.) |
| 84 | } |
| 85 | |
| 86 | if actual.Pathscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ResourceID#Path. != v.Path { |
| 87 | t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected the path to be `%q` but got %q", v.Path, actual.Pathscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ResourceID#Path.) |
| 88 | } |
| 89 | } |
| 90 | } |