Skip to content

Commit

Permalink
add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
pasocon1993 committed May 24, 2019
1 parent 2bcd6f9 commit 2fa2b8f
Showing 1 changed file with 105 additions and 3 deletions.
108 changes: 105 additions & 3 deletions src/test/java/test/com/qiniu/sms/SmsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.qiniu.http.Client;
import com.qiniu.http.Response;
import com.qiniu.sms.SmsManager;
import com.qiniu.sms.model.SignatureInfo;
import com.qiniu.sms.model.TemplateInfo;
import com.qiniu.util.Auth;
import com.qiniu.util.StringMap;

Expand All @@ -37,9 +39,109 @@ public void setUp() throws Exception {
@Test
public void testSendMessage() {
try {
Map<String,String> paramMap = new HashMap();
Response resp = smsManager.sendMessage("test",new String[]{"10086"},paramMap);

Map<String,String> paramMap = new HashMap<String, String>();
Response response = smsManager.sendMessage("test",new String[]{"10086"},paramMap);
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testDescribeSignature() {
try {
Response response = smsManager.describeSignature("passed",0,0);
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testDescribeSignatureItems() {
try {
SignatureInfo signatureInfo = smsManager.describeSignatureItems("passed",0,0);
Assert.assertNotNull(signatureInfo);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testCreateSignature() {
try {
Response response = smsManager.createSignature("signature","app",new String[] {"data:image/gif;base64,xxxxxxxxxx"});
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testModifySignature() {
try {
Response response = smsManager.modifySignature("signatureId","signature");
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testDeleteSignature() {
try {
Response response = smsManager.deleteSignature("signatureId");
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testDescribeTemplate() {
try {
Response response = smsManager.describeTemplate("passed",0,0);
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testDescribeTemplateItems() {
try {
TemplateInfo templateInfo = smsManager.describeTemplateItems("passed",0,0);
Assert.assertNotNull(templateInfo);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testCreateTemplate() {
try {
Response response = smsManager.createTemplate("name","template","notification","desc","signatureId");
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testModifyTemplate() {
try {
Response response = smsManager.modifyTemplate("templateId","name","template","desc","signatureId");
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
}

@Test
public void testDeleteTemplate() {
try {
Response response = smsManager.deleteTemplate("templateId");
Assert.assertNotNull(response);
} catch (QiniuException e) {
Assert.assertEquals(401, e.code());
}
Expand Down

0 comments on commit 2fa2b8f

Please sign in to comment.