-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_language_attributes.py
More file actions
103 lines (90 loc) · 3.85 KB
/
Copy pathtest_language_attributes.py
File metadata and controls
103 lines (90 loc) · 3.85 KB
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
95
96
97
98
99
100
101
102
103
import unittest
import spider as sp
import os
import utils
class TestWeb(unittest.TestCase):
def setUp(self):
# Delete if already exists:
utils.remove_web("temp")
def tearDown(self):
# Delete if exists:
utils.remove_web("temp")
def test_creation_language_attributes(self):
# Create web:
myWeb = sp.createWeb({
"path" : os.path.join(os.getcwd(), "temp"),
"title" : "temp"
})
# Check attributes:
utils.check_attribute(self, myWeb.language, list, ["en"])
utils.check_attribute(self, myWeb.title, dict, {"en" : "temp"})
utils.remove_web("temp")
# Create web:
myWeb = sp.createWeb({
"path" : os.path.join(os.getcwd(), "temp"),
"title" : {"fr": "temp"}
})
# Check attributes:
utils.check_attribute(self, myWeb.language, list, ["fr"])
utils.check_attribute(self, myWeb.title, dict, {"fr" : "temp"})
utils.remove_web("temp")
# Create web:
myWeb = sp.createWeb({
"path" : os.path.join(os.getcwd(), "temp"),
"language" : ["fr"],
"title" : "temp"
})
# Check attributes:
utils.check_attribute(self, myWeb.language, list, ["fr"])
utils.check_attribute(self, myWeb.title, dict, {"fr" : "temp"})
utils.remove_web("temp")
# Create web:
myWeb = sp.createWeb({
"path" : os.path.join(os.getcwd(), "temp"),
"language" : ["fr"],
"title" : {"sp": "temp"}
})
# Check attributes:
utils.check_attribute(self, myWeb.language, list, ["fr", "sp"])
utils.check_attribute(self, myWeb.title, dict, {"sp" : "temp", "fr" : ""})
utils.remove_web("temp")
# Create web:
myWeb = sp.createWeb({
"path" : os.path.join(os.getcwd(), "temp"),
"title" : "title",
"subject" : "subject",
"description" : "description",
"type" : "type",
"source" : "source",
"creator" : "creator",
"publisher" : "publisher",
"contributor" : "contributor",
"rights" : "rights",
"audience" : "audience",
"provenance" : "provenance",
"rightsHolder" : "rightsHolder",
"accrualMethod" : "accrualMethod",
"accrualPeriodicity" : "accrualPeriodicity",
"accrualPolicy" : "accrualPolicy"
})
# Check attributes:
utils.check_attribute(self, myWeb.language, list, ["en"])
utils.check_attribute(self, myWeb.title, dict, {"en" : "title"})
utils.check_attribute(self, myWeb.subject, dict, {"en" : "subject"})
utils.check_attribute(self, myWeb.description, dict, {"en" : "description"})
utils.check_attribute(self, myWeb.type, dict, {"en" : "type"})
utils.check_attribute(self, myWeb.source, dict, {"en" : "source"})
utils.check_attribute(self, myWeb.creator, dict, {"en" : "creator"})
utils.check_attribute(self, myWeb.publisher, dict, {"en" : "publisher"})
utils.check_attribute(self, myWeb.contributor, dict, {"en" : "contributor"})
utils.check_attribute(self, myWeb.rights, dict, {"en" : "rights"})
utils.check_attribute(self, myWeb.audience, dict, {"en" : "audience"})
utils.check_attribute(self, myWeb.provenance, dict, {"en" : "provenance"})
utils.check_attribute(self, myWeb.rightsHolder, dict, {"en" : "rightsHolder"})
utils.check_attribute(self, myWeb.accrualMethod, dict, {"en" : "accrualMethod"})
utils.check_attribute(self, myWeb.accrualPeriodicity, dict, {"en" : "accrualPeriodicity"})
utils.check_attribute(self, myWeb.accrualPolicy, dict, {"en" : "accrualPolicy"})
utils.remove_web("temp")
# Run
if __name__ == "__main__":
unittest.main()