There are a few test scripts in the src/ directory.

To set up the private database for tests:
=========================================


1) Create the private database from scratch:

/-----------------
          .$ mtn -d PRIV_A.db read < test_keys/johndoe
          .$ mtn setup -d PRIV_A.db -b test_branch -k johndoe test_branch
          .$ cd test_branch
test_branch$ cat > README
First version of README
^D
test_branch$ mtn add README
test_branch$ mtn ci -m"First commit to the test database"
test_branch$ cd ..
          .$
\-----------------

OR,

2) Copy another database to PRIV_A.db:

There is one example that contains branching and merging:

/-----------------
          .$ cp test-database.db PRIV_A.db
\-----------------

But of course, this is just a toy example.


Setting up the public database:
===============================

Use the setup script:

/-----------------
.$ ./setup.sh
\-----------------

And make sure the public key for the user is a Nettle public key; the
private key for the user (whose path will be either given in the test-pull
script, for example) is the corresponding Nettle private key.

For example:

/++++++++++++++++++++++++++

$ ./setup.sh
(...)
The current path (in case you need to cut&paste) is:  /home/jeronimo/work/mono/info.aleph0.apso/src
Public key for Nettle (ABSOLUTE path)? /home/jeronimo/work/mono/info.aleph0.apso/src/test-data/nettle_pub
(...)
mtn: beginning commit on branch 'apso'
mtn: committed revision 67bbc3100d61b823f871064683a43b1b8c20b8c7
Apso public database setup complete.

$ cp test-data/nettle_priv ./johndoe

$ ./test-pull
(...)
[ Keystore store_keymap end ]
[ PubRepository accept_deltas end ]
[ PubRepository: pull end ]

$ ./test-grant
(...)
Will add to vc: users/juliedoe
Will save his key to /home/jeronimo/work/mono/info.aleph0.apso/src/PUB_A.wc/users/juliedoe/public_key
KEYSAVE: /home/jeronimo/work/mono/info.aleph0.apso/src/PUB_A.wc/users/juliedoe/public_key
[ PubRepository grant end ]

\++++++++++++++++++++++++++

Also, suppose you have used "johndoe" as the monotone key. You need to change monotonerc
to never interectively ask the password.


Testing:
========

Now, first test:

/-----------------
$ ./test-pull
\-----------------

/-----------------
$ ./test-grant
\-----------------

