Skip to content

Commit 2fa2b8f

Browse files
committed
add more test
1 parent 2bcd6f9 commit 2fa2b8f

File tree

1 file changed

+105
-3
lines changed

1 file changed

+105
-3
lines changed

src/test/java/test/com/qiniu/sms/SmsTest.java

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import com.qiniu.http.Client;
1616
import com.qiniu.http.Response;
1717
import com.qiniu.sms.SmsManager;
18+
import com.qiniu.sms.model.SignatureInfo;
19+
import com.qiniu.sms.model.TemplateInfo;
1820
import com.qiniu.util.Auth;
1921
import com.qiniu.util.StringMap;
2022

@@ -37,9 +39,109 @@ public void setUp() throws Exception {
3739
@Test
3840
public void testSendMessage() {
3941
try {
40-
Map<String,String> paramMap = new HashMap();
41-
Response resp = smsManager.sendMessage("test",new String[]{"10086"},paramMap);
42-
42+
Map<String,String> paramMap = new HashMap<String, String>();
43+
Response response = smsManager.sendMessage("test",new String[]{"10086"},paramMap);
44+
Assert.assertNotNull(response);
45+
} catch (QiniuException e) {
46+
Assert.assertEquals(401, e.code());
47+
}
48+
}
49+
50+
@Test
51+
public void testDescribeSignature() {
52+
try {
53+
Response response = smsManager.describeSignature("passed",0,0);
54+
Assert.assertNotNull(response);
55+
} catch (QiniuException e) {
56+
Assert.assertEquals(401, e.code());
57+
}
58+
}
59+
60+
@Test
61+
public void testDescribeSignatureItems() {
62+
try {
63+
SignatureInfo signatureInfo = smsManager.describeSignatureItems("passed",0,0);
64+
Assert.assertNotNull(signatureInfo);
65+
} catch (QiniuException e) {
66+
Assert.assertEquals(401, e.code());
67+
}
68+
}
69+
70+
@Test
71+
public void testCreateSignature() {
72+
try {
73+
Response response = smsManager.createSignature("signature","app",new String[] {"data:image/gif;base64,xxxxxxxxxx"});
74+
Assert.assertNotNull(response);
75+
} catch (QiniuException e) {
76+
Assert.assertEquals(401, e.code());
77+
}
78+
}
79+
80+
@Test
81+
public void testModifySignature() {
82+
try {
83+
Response response = smsManager.modifySignature("signatureId","signature");
84+
Assert.assertNotNull(response);
85+
} catch (QiniuException e) {
86+
Assert.assertEquals(401, e.code());
87+
}
88+
}
89+
90+
@Test
91+
public void testDeleteSignature() {
92+
try {
93+
Response response = smsManager.deleteSignature("signatureId");
94+
Assert.assertNotNull(response);
95+
} catch (QiniuException e) {
96+
Assert.assertEquals(401, e.code());
97+
}
98+
}
99+
100+
@Test
101+
public void testDescribeTemplate() {
102+
try {
103+
Response response = smsManager.describeTemplate("passed",0,0);
104+
Assert.assertNotNull(response);
105+
} catch (QiniuException e) {
106+
Assert.assertEquals(401, e.code());
107+
}
108+
}
109+
110+
@Test
111+
public void testDescribeTemplateItems() {
112+
try {
113+
TemplateInfo templateInfo = smsManager.describeTemplateItems("passed",0,0);
114+
Assert.assertNotNull(templateInfo);
115+
} catch (QiniuException e) {
116+
Assert.assertEquals(401, e.code());
117+
}
118+
}
119+
120+
@Test
121+
public void testCreateTemplate() {
122+
try {
123+
Response response = smsManager.createTemplate("name","template","notification","desc","signatureId");
124+
Assert.assertNotNull(response);
125+
} catch (QiniuException e) {
126+
Assert.assertEquals(401, e.code());
127+
}
128+
}
129+
130+
@Test
131+
public void testModifyTemplate() {
132+
try {
133+
Response response = smsManager.modifyTemplate("templateId","name","template","desc","signatureId");
134+
Assert.assertNotNull(response);
135+
} catch (QiniuException e) {
136+
Assert.assertEquals(401, e.code());
137+
}
138+
}
139+
140+
@Test
141+
public void testDeleteTemplate() {
142+
try {
143+
Response response = smsManager.deleteTemplate("templateId");
144+
Assert.assertNotNull(response);
43145
} catch (QiniuException e) {
44146
Assert.assertEquals(401, e.code());
45147
}

0 commit comments

Comments
 (0)