-
Notifications
You must be signed in to change notification settings - Fork 0
/
catalog_test.go
94 lines (81 loc) · 2.25 KB
/
catalog_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package gofaapi
import (
"encoding/xml"
"io/ioutil"
"testing"
)
func TestAddressMarshalling(t *testing.T) {
address := AddressList{
SenderAddress: Address{
Customertype: "Private",
Vatnumber: "12345",
Taxnumber: "44444",
Company: "Pizza Domain",
Gender: "Unknown",
FirstName: "Stefano",
LastName: "Priebsch",
Address: "Musterstrasse. 13",
AddressAdd: "3. Stock",
Postcode: "98234",
City: "Priebschhausen",
County: "Hessen",
Locale: "de",
Phone: "09333233323332"},
DeliverAddress: Address{
Customertype: "Company",
Vatnumber: "12345",
Taxnumber: "44444",
Company: "flyeralarm",
Gender: "male",
FirstName: "Gustavo",
LastName: "Gans",
Address: "hustenstr. 13",
AddressAdd: "stock 3",
Postcode: "98234",
City: "frankfurt",
County: "hessen",
Locale: "de",
Phone: "09312423423"},
InvoiceAddress: Address{
Customertype: "Company",
Vatnumber: "12345",
Taxnumber: "44444",
Company: "flyeralarm",
Gender: "male",
FirstName: "Walter",
LastName: "Peterson",
Address: "hustenstr. 13",
AddressAdd: "stock 3",
Postcode: "98234",
City: "frankfurt",
County: "hessen",
Locale: "de",
Phone: "09312423423"}}
f, _ := ioutil.ReadFile("testdata/addresses.xml")
actualXML, _ := xml.MarshalIndent(address, "", " ")
if string(actualXML) != string(f) {
t.Error("XMLs are not equal!")
}
}
func TestOptionMarshalling(t *testing.T) {
options := make(Options)
options[100] = 1
options[300] = 40
options[430] = 123
f, _ := ioutil.ReadFile("testdata/options.xml")
actualXML, _ := xml.MarshalIndent(options, "", " ")
if string(actualXML) != string(f) {
t.Error("XMLs are not equal!")
}
}
func TestUploadInfoMashalling(t *testing.T) {
uploadinfo := UploadInfo{UploadType: "upload",
Time: "01.03.2019 00:10:11",
Text: "Upload via Api.",
ReferenceText: "Upload Reference 1"}
f, _ := ioutil.ReadFile("testdata/uploadinfo.xml")
actualXML, _ := xml.MarshalIndent(uploadinfo, "", " ")
if string(actualXML) != string(f) {
t.Error("XMLs are not equal!")
}
}