1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-06-29 00:21:53 +02:00

Adds test for authentication on expected json. Adds test to metaissue

This commit is contained in:
Bidesh Thapaliya
2016-09-27 13:26:07 +02:00
parent d3ec8f16c0
commit e75e7750f2
3 changed files with 94 additions and 3 deletions

View File

@ -410,6 +410,40 @@ func TestMetaIssueTypes_GetMandatoryFields(t *testing.T) {
}
func TestMetaIssueTypes_GetMandatoryFields_NonExistentRequiredKey_Fail(t *testing.T) {
data := make(map[string]interface{})
data["summary"] = map[string]interface{}{
"name": "Summary",
}
m := new(MetaIssueTypes)
m.Fields = data
_, err := m.GetMandatoryFields()
if err == nil {
t.Error("Expected non nil errpr, recieved nil")
}
}
func TestMetaIssueTypes_GetMandatoryFields_NonExistentNameKey_Fail(t *testing.T) {
data := make(map[string]interface{})
data["summary"] = map[string]interface{}{
"required": true,
}
m := new(MetaIssueTypes)
m.Fields = data
_, err := m.GetMandatoryFields()
if err == nil {
t.Error("Expected non nil errpr, recieved nil")
}
}
func TestMetaIssueTypes_GetAllFields(t *testing.T) {
data := make(map[string]interface{})
@ -443,6 +477,23 @@ func TestMetaIssueTypes_GetAllFields(t *testing.T) {
}
func TestMetaIssueTypes_GetAllFields_NonExistingNameKey_Fail(t *testing.T) {
data := make(map[string]interface{})
data["summary"] = map[string]interface{}{
"required": true,
}
m := new(MetaIssueTypes)
m.Fields = data
_, err := m.GetAllFields()
if err == nil {
t.Error("Expected non nil error, recieved nil")
}
}
func TestCreateMetaInfo_GetProjectName_Success(t *testing.T) {
metainfo := new(CreateMetaInfo)
metainfo.Projects = append(metainfo.Projects, &MetaProject{