mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-04-25 12:14:56 +02:00
Adds test for metaissue
This commit is contained in:
parent
7219fd57e4
commit
14143f2f57
@ -489,6 +489,95 @@ func TestMetaIssueType_GetAllFields_NonExistingNameKey_Fail(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMetaIssueType_CheckCompleteAndAvailable_MandatoryMissing(t *testing.T) {
|
||||
data := make(map[string]interface{})
|
||||
|
||||
data["summary"] = map[string]interface{}{
|
||||
"required": true,
|
||||
"name": "Summary",
|
||||
}
|
||||
|
||||
data["someKey"] = map[string]interface{}{
|
||||
"required": false,
|
||||
"name": "SomeKey",
|
||||
}
|
||||
|
||||
config := map[string]string{
|
||||
"SomeKey": "somevalue",
|
||||
}
|
||||
|
||||
m := new(MetaIssueType)
|
||||
m.Fields = data
|
||||
|
||||
ok, err := m.CheckCompleteAndAvailable(config)
|
||||
if err == nil {
|
||||
t.Error("Expected non nil error. Recieved nil")
|
||||
}
|
||||
|
||||
if ok != false {
|
||||
t.Error("Expected false, got true")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestMetaIssueType_CheckCompleteAndAvailable_NotAvailable(t *testing.T) {
|
||||
data := make(map[string]interface{})
|
||||
|
||||
data["summary"] = map[string]interface{}{
|
||||
"required": true,
|
||||
"name": "Summary",
|
||||
}
|
||||
|
||||
config := map[string]string{
|
||||
"SomeKey": "somevalue",
|
||||
}
|
||||
|
||||
m := new(MetaIssueType)
|
||||
m.Fields = data
|
||||
|
||||
ok, err := m.CheckCompleteAndAvailable(config)
|
||||
if err == nil {
|
||||
t.Error("Expected non nil error. Recieved nil")
|
||||
}
|
||||
|
||||
if ok != false {
|
||||
t.Error("Expected false, got true")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestMetaIssueType_CheckCompleteAndAvailable_Success(t *testing.T) {
|
||||
data := make(map[string]interface{})
|
||||
|
||||
data["summary"] = map[string]interface{}{
|
||||
"required": true,
|
||||
"name": "Summary",
|
||||
}
|
||||
|
||||
data["someKey"] = map[string]interface{}{
|
||||
"required": false,
|
||||
"name": "SomeKey",
|
||||
}
|
||||
|
||||
config := map[string]string{
|
||||
"SomeKey": "somevalue",
|
||||
"Summary": "Issue summary",
|
||||
}
|
||||
|
||||
m := new(MetaIssueType)
|
||||
m.Fields = data
|
||||
|
||||
ok, err := m.CheckCompleteAndAvailable(config)
|
||||
if err != nil {
|
||||
t.Error("Expected nil error. Recieved %s", err)
|
||||
}
|
||||
|
||||
if ok != true {
|
||||
t.Error("Expected true, got false")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCreateMetaInfo_GetProjectWithName_Success(t *testing.T) {
|
||||
metainfo := new(CreateMetaInfo)
|
||||
metainfo.Projects = append(metainfo.Projects, &MetaProject{
|
||||
|
Loading…
x
Reference in New Issue
Block a user