File: __driver__.lua

package info (click to toggle)
monotone 1.1-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,984 kB
  • ctags: 8,622
  • sloc: cpp: 86,450; sh: 6,906; perl: 924; makefile: 813; python: 517; lisp: 379; sql: 118; exp: 91; ansic: 52
file content (43 lines) | stat: -rw-r--r-- 1,710 bytes parent folder | download | duplicates (4)
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
-- Test automate key management functions:
-- generate_key (also tested in ../automate_genkey)
-- get_public_key
-- drop_public_key
-- put_public_key
-- keys

mtn_setup()

includecommon("basic_io.lua")

check(mtn("automate", "generate_key", "foo@bar.com", "foopass"), 0, false, false)
check(mtn("pubkey", "foo@bar.com"), 0, true)
-- non-automate output uses OS-specific line endings, while automate uses Unix line endings.
canonicalize("stdout")
rename("stdout", "key_packet")
check(mtn("automate", "get_public_key", "foo@bar.com"), 0, true)
check(samefile("stdout", "key_packet"))
check(mtn("automate", "drop_public_key", "foo@bar.com"), 0, false, false)

-- drop_public_key does not drop private key
check(mtn("automate", "keys"), 0, true)
parsed = parse_basic_io(readfile("stdout"))
i = find_basic_io_line (parsed, {name = "local_name", values = "foo@bar.com"})
i = i + 1
check_basic_io_line (i, parsed[i], "public_location", {"keystore"}, false)
i = i + 1
check_basic_io_line (i, parsed[i], "private_location", {"keystore"}, false)

check(mtn("automate", "put_public_key", readfile("key_packet")), 0)
check(mtn("automate", "keys"), 0, true)
parsed = parse_basic_io(readfile("stdout"))
i = find_basic_io_line (parsed, {name = "local_name", values = "foo@bar.com"})
i = i + 1
check_basic_io_line (i, parsed[i], "public_location", {"database", "keystore"}, false)
i = i + 1
check_basic_io_line (i, parsed[i], "private_location", {"keystore"}, false)

-- Reading input that is not in packet format does not produce an
-- error message. It also does not create a key in the database.
check(mtn("automate", "put_public_key", readfile("stdout")), 0)
check(mtn("automate", "read_packets", readfile("stdout")), 0)