test_add_Attribute.py
4.04 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
from atdd.PcPost import PcPost
import random
# 新增员工属性
class AddAttribute(PcPost):
interfaceUrl = "/contact/Apicp/Attribute/Save"
# 0~10000的随机整数
x = random.randint(0, 10000)
def setUp(self):
self.do_login(self.host, self.mobile, self.psw, self.domain)
# 新增单行文本属性
def test_add_text(self):
data = {
"attr_name": "单行文本"+str(self.x),
"position": 0,
"type": 1, #类型为单行文本
"order": 0,
"is_system": 0,
"is_open_cp": 1,
"is_open_cp_edit": 0,
"is_open": 1,
"is_open_edit": 0,
"is_required_cp": 0,
"is_required_cp_edit": 0,
"is_required": 0,
"is_required_edit": 0,
"is_show": 1,
"is_show_edit": 0
}
result = self.PcPost(self.interfaceUrl,data)
return result
# 新增多行文本
def test_add_MultilineText(self):
data = {
"attr_name": "多行文本" + str(self.x),
"position": 0,
"type": 2, #类型为多行文本
"order": 0,
"is_system": 0,
"is_open_cp": 1,
"is_open_cp_edit": 0,
"is_open": 1,
"is_open_edit": 0,
"is_required_cp": 0,
"is_required_cp_edit": 0,
"is_required": 0,
"is_required_edit": 0,
"is_show": 1,
"is_show_edit": 0
}
result = self.PcPost(self.interfaceUrl, data)
return result
# 新增日期
def test_add_Date(self):
data = {
"attr_name": "日期" + str(self.x),
"position": 0,
"type": 4, # 类型为日期
"order": 0,
"is_system": 0,
"is_open_cp": 1,
"is_open_cp_edit": 0,
"is_open": 1,
"is_open_edit": 0,
"is_required_cp": 0,
"is_required_cp_edit": 0,
"is_required": 0,
"is_required_edit": 0,
"is_show": 1,
"is_show_edit": 0
}
result = self.PcPost(self.interfaceUrl, data)
return result
# 新建单选
def test_add_singleSelect(self):
data = {
"option[0][name]": "漂亮",
"option[0][value]": 0,
"option[1][name]": "可爱",
"option[1][value]": 1,
"option[2][name]": "任性",
"option[2][value]": 2,
"option[3][name]": "有钱",
"option[3][value]": 3,
"attr_name": "单选" + str(self.x),
"position": 0,
"type": 7, # 类型为单选
"order": 0,
"is_system": 0,
"is_open_cp": 1,
"is_open_cp_edit": 0,
"is_open": 1,
"is_open_edit": 0,
"is_required_cp": 0,
"is_required_cp_edit": 0,
"is_required": 0,
"is_required_edit": 0,
"is_show": 1,
"is_show_edit": 0
}
result = self.PcPost(self.interfaceUrl, data)
return result
# 新建多选
def test_add_multiSelect(self):
data = {
"option[0][name]": "漂亮",
"option[0][value]": 0,
"option[1][name]": "可爱",
"option[1][value]": 1,
"option[2][name]": "任性",
"option[2][value]": 2,
"option[3][name]": "有钱",
"option[3][value]": 3,
"attr_name": "多选" + str(self.x),
"position": 0,
"type": 8, # 类型为多选
"order": 0,
"is_system": 0,
"is_open_cp": 1,
"is_open_cp_edit": 0,
"is_open": 1,
"is_open_edit": 0,
"is_required_cp": 0,
"is_required_cp_edit": 0,
"is_required": 0,
"is_required_edit": 0,
"is_show": 1,
"is_show_edit": 0
}
result = self.PcPost(self.interfaceUrl, data)
return result