summaryrefslogtreecommitdiff
path: root/wrappers/EduVpnCommon/tests/eduvpncommon/VerifyTests.java
blob: 117f5ef1c6382cfb65d7118af2aacea1a9d45773 (plain)
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
package eduvpncommon;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;

class VerifyTests {
    private static final Path testDataDir = Paths.get("../../test_data");

    @BeforeAll
    static void oneTimeSetup() throws IOException {
        Discovery.insecureTestingSetExtraKey(Files.lines(testDataDir.resolve("dummy/public.key")).reduce((a, b) -> b).get());
    }

    @Test
    void testValid() throws IOException, VerifyException {
        Discovery.verify(
                Files.readAllBytes(Paths.get("../../test_data/dummy/server_list.json.minisig")),
                Files.readAllBytes(Paths.get("../../test_data/dummy/server_list.json")),
                "server_list.json",
                Instant.EPOCH
        );
    }

    //TODO
}