-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from imjoey/add_resourceid_parser
Add general purpose function to parse resource ID
- v9.9.9
- v2.2.0-alpha2
- v2.2.0-alpha1
- v2.1.5
- v2.1.5-alpha02
- v2.1.5-alpha01
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- v2.0.0-alpha17
- v2.0.0-alpha16
- v2.0.0-alpha15
- v2.0.0-alpha14
- v2.0.0-alpha13
- v2.0.0-alpha12
- v2.0.0-alpha11
- v2.0.0-alpha10
- v2.0.0-alpha9
- v2.0.0-alpha8
- v2.0.0-alpha7
- v2.0.0-alpha6
- v2.0.0-alpha5
- v2.0.0-alpha4
- v2.0.0-alpha3
- v2.0.0-alpha2
- v2.0.0-alpha1
- v0.99.0
- v0.4.2
- v0.4.1
Showing
8 changed files
with
92 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package ovirt | ||
|
||
import "testing" | ||
|
||
func TestParseResourceID(t *testing.T) { | ||
validResourceID := []struct { | ||
ResourceID string | ||
Count int | ||
}{ | ||
{ | ||
"08f9d3ec-5768-479f-aa16-d2d9934b356a:8daea363-7535-4af3-a80f-e0f6c02666e0", | ||
2, | ||
}, | ||
{ | ||
"24252dc8-2a5a-4871-9601-7486a775d0e3:f59d3de3-512e-4eb3-9f4b-0e2395297b7c:8daea363-7535-4af3-a80f-e0f6c02666e0", | ||
3, | ||
}, | ||
{ | ||
"df18a81a-02eb-476e-bd42-bf87cbd5b948:615bdbb1-4d2a-443d-8ede-4f15b141603c:4104093f-5ba8-4d9f-849b-e4ad75143be7:7e8f03c7-0ac0-40b8-9497-9c64d4001f54", | ||
4, | ||
}, | ||
} | ||
|
||
for _, v := range validResourceID { | ||
_, err := parseResourceID(v.ResourceID, v.Count) | ||
if err != nil { | ||
t.Fatalf("%s should be a valid Resource ID: %s", v.ResourceID, err) | ||
} | ||
} | ||
|
||
invalidResourceID := []struct { | ||
ResourceID string | ||
Count int | ||
}{ | ||
{ | ||
"08f9d3ec-5768-479f-aa16-d2d9934b356a:8daea363-7535-4af3-a80f-e0f6c02666e0", | ||
3, | ||
}, | ||
{ | ||
"24252dc8-2a5a-4871-9601-7486a775d0e3:f59d3de3-512e-4eb3-9f4b-0e2395297b7c:8daea363-7535-4af3-a80f-e0f6c02666e0", | ||
2, | ||
}, | ||
{ | ||
"df18a81a-02eb-476e-bd42-bf87cbd5b948:615bdbb1-4d2a-443d-8ede-4f15b141603c:4104093f-5ba8-4d9f-849b-e4ad75143be7:7e8f03c7-0ac0-40b8-9497-9c64d4001f54", | ||
5, | ||
}, | ||
} | ||
|
||
for _, v := range invalidResourceID { | ||
_, err := parseResourceID(v.ResourceID, v.Count) | ||
if err == nil { | ||
t.Fatalf("%s should be an invalid Resource ID: %s", v.ResourceID, err) | ||
} | ||
} | ||
|
||
} |