aboutsummaryrefslogtreecommitdiffstats
path: root/timetask/module_test.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-04 00:26:03 +0200
committerTeddy Wing2017-06-04 00:26:03 +0200
commit34fb8b7b98076b65b05efc2bbaff013fbbbf5116 (patch)
treeeae64bb174ff4b708f2ba701168acac373079020 /timetask/module_test.go
parentf8821fa88888491bf49d8cd626f7a011665c6066 (diff)
parent6a62cc9aef3684ef0bd72e6ab79157a699b01c72 (diff)
downloadtimetasker-34fb8b7b98076b65b05efc2bbaff013fbbbf5116.tar.bz2
Merge branch 'command-to-get-module-ids-of-project' into timetasker-daily
Diffstat (limited to 'timetask/module_test.go')
-rw-r--r--timetask/module_test.go50
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&amp;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&amp;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)
+}