-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathKeyTest.java
More file actions
48 lines (39 loc) · 1.22 KB
/
KeyTest.java
File metadata and controls
48 lines (39 loc) · 1.22 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
package io.bytom.integration;
import org.junit.Assert;
import org.junit.Test;
import io.bytom.api.Key;
import io.bytom.exception.BytomException;
import io.bytom.http.Client;
public class KeyTest {
private static Client client;
@Test
public void run() throws Exception {
testCreateKey();
testListKeys();
testDeleteKey();
testResetKeyPwd();
}
public void testCreateKey() throws BytomException {
client = TestUtils.generateClient();
Key key = Key.create(client, "testkey004", "123456");
Assert.assertNotEquals(null, key);
}
public void testListKeys() throws Exception {
client = TestUtils.generateClient();
Key.Items keys = new Key.QueryBuilder().list(client);
Assert.assertNotNull(keys.data);
Assert.assertNotNull(keys.data.get(0).alias);
Assert.assertNotNull(keys.data.get(0).file);
}
public void testDeleteKey() throws Exception {
client = TestUtils.generateClient();
Key key = Key.create(client, "testdelkey", "123456");
String password = "123456";
Key.delete(client, key.xpub, password);
}
public void testResetKeyPwd() throws Exception {
client = TestUtils.generateClient();
Key key=Key.create(client, "testresetkey1", "123456");
Key.resetPassword(client, key.xpub, "123456", "111111");
}
}