diff options
| author | Teddy Wing | 2017-06-04 02:07:50 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-06-04 02:07:50 +0200 | 
| commit | 02e4fb5d0d95b8c5c5442ee0a97b960f1296c236 (patch) | |
| tree | 4cf323694692322036b80d2d921ff966096c6c36 /timetask/module_test.go | |
| parent | 055301ca09d57b759b290d897bbb7560460251ca (diff) | |
| parent | 9b6a6543e351308939bd420243507368b0669e63 (diff) | |
| download | timetasker-02e4fb5d0d95b8c5c5442ee0a97b960f1296c236.tar.bz2 | |
Merge branch 'timetasker-daily'
Diffstat (limited to 'timetask/module_test.go')
| -rw-r--r-- | timetask/module_test.go | 50 | 
1 files changed, 50 insertions, 0 deletions
| diff --git a/timetask/module_test.go b/timetask/module_test.go new file mode 100644 index 0000000..cee87c5 --- /dev/null +++ b/timetask/module_test.go @@ -0,0 +1,50 @@ +package timetask + +import "testing" + +const modules_xml = `<?xml version="1.0" encoding="UTF-8" ?> +<ajax-response> +	<response type="object" id="ModuleList"> +					<item> +						<moduleid><![CDATA[55555]]></moduleid> +						<modulename><![CDATA[R&D]]></modulename> +						</item> +					<item> +						<moduleid><![CDATA[77777]]></moduleid> +						<modulename><![CDATA[Sprint 1]]></modulename> +						</item> +					<item> +						<moduleid><![CDATA[222222]]></moduleid> +						<modulename><![CDATA[Sprint 2]]></modulename> +						</item> +			</response> +</ajax-response>` + +func TestModuleParseXML(t *testing.T) { +	modules, err := ModuleParseXML(modules_xml) +	if err != nil { +		t.Error(err) +	} + +	_ = []Module{ // wanted +		Module{ +			ID:   55555, +			Name: "R&D", +		}, +		Module{ +			ID:   77777, +			Name: "Sprint 1", +		}, +		Module{ +			ID:   222222, +			Name: "Sprint 2", +		}, +	} + +	// Need a way to compare slices +	// if modules != wanted { +	// 	t.Errorf("Module parsing failed. Wanted %+v got %+v", wanted, modules) +	// } + +	t.Logf("%+v\n", modules) +} | 
