package peergos.tests;

import org.junit.*;
import peergos.corenode.*;
import peergos.user.*;

import java.io.*;
import java.net.*;

public class UserTests {

    UserContext context;

    @Before
    public void setup() throws IOException {
        String username = "test01";
        String password = "test01";
        UserWithRoot userWithRoot = UserUtil.generateUser(username, password);
        DHTClient.HTTP dht = new DHTClient.HTTP(new URL("http://localhost/"));
        Btree.HTTP btree = new Btree.HTTP(new URL("http://localhost/"));
        HTTPCoreNode coreNode = new HTTPCoreNode(new URL("http://localhost"+":"+HTTPCoreNodeServer.PORT+"/"));
        context = new UserContext(username, userWithRoot.getUser(), userWithRoot.getRoot(), dht, btree, coreNode);
        context.init();
    }

    @Test
    public void signup() {

    }
}

@@ -60,24 +60,49 @@
 corenode.*;%0A
+import peergos.crypto.*;%0A
 import peerg
@@ -112,16 +112,16 @@
 user.*;%0A
-
 %0Aimport 
@@ -411,16 +411,397 @@
 sword);%0A
+        UserPublicKey expected = UserPublicKey.fromString(%227HvEWP6yd1UD8rOorfFrieJ8S7yC8+l3VisV9kXNiHmI7Eav7+3GTRSVBRCymItrzebUUoCi39M6rdgeOU9sXXFD%22);%0A        if (! expected.equals(userWithRoot.getUser().toUserPublicKey()))%0A            throw new IllegalStateException(%22Generated user diferent from the Javascript! %5Cn%22+userWithRoot.getUser().toUserPublicKey() + %22 != %5Cn%22+expected);%0A
         
@@ -1231,19 +1231,47 @@
 oid 
-signup() %7B%0A
+login() %7B%0A        System.out.println();
 %0A   

Test to ensure keys generated in Java using Scrypt are same as from JS