Commit graph

53 commits

Author SHA1 Message Date
brian m. carlson
e482bc6e36
Allow completely disabling execution from config file.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-12-09 00:15:25 +00:00
brian m. carlson
a78ef81c3a
Set all test files executable.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-11-18 03:10:22 +00:00
brian m. carlson
182759b9b8
Add basic tests for KeyboardShortcuts.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-08-21 07:42:03 +00:00
brian m. carlson
9c9662ae9a
Add support for loading configuration files.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-08-05 23:23:34 +00:00
brian m. carlson
d66aa22c12
testgit: use with statements to open files.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-18 23:10:22 +00:00
brian m. carlson
74ab2d9fc7
testdatabase: use with statement to open files.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-18 23:07:21 +00:00
brian m. carlson
72e4372532
testfilemanip: use with statement for opening files.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-18 23:04:39 +00:00
brian m. carlson
000ca6c1a1
Explicitly specify encoding.
The default encoding is utf-8, which is what we want, but it's confusing
not to specify it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-16 23:18:20 +00:00
brian m. carlson
d615f6b2e7
Explicitly clean up temporary directories.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-15 20:39:17 +00:00
brian m. carlson
3f1a8c9939
Move git tests all to one file.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-15 20:36:11 +00:00
brian m. carlson
85fdd1862f
testfilemanip: bring up to PEP 8 standards.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-13 16:25:16 +00:00
brian m. carlson
ab85ae76b4
testdatabase: bring up to PEP 8 standards.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-13 16:19:19 +00:00
brian m. carlson
14785e7437
testversion: refactor to eliminate duplicate code.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-13 15:30:48 +00:00
brian m. carlson
af092061a2
testversion: bring spacing up to PEP 8 standards.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-13 15:26:04 +00:00
brian m. carlson
3cc24f5806
testgit: bring up to PEP 8 standards.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-13 15:22:28 +00:00
brian m. carlson
f8d5ea87e3
testcallbacks: add spacing for PEP 8.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-07-12 18:53:42 +00:00
brian m. carlson
abf83e309b
Canonicalize transaction types.
Now, if the type "hash" and a more specific type (e.g. "sha256") are
present, the more specific type will remain and the generic type will be
removed.  This allows creating databases that can be imported by earlier
versions of newfol.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-05-11 20:18:01 +00:00
brian m. carlson
0bd63de712
Add tests for View.is_callback_type.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-04-19 15:21:54 +00:00
brian m. carlson
9a3086c9d5
Allow multiple transaction types in schema file.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-03-25 23:21:03 +00:00
brian m. carlson
daa3d6fef7
Ensure that records() always returns a list.
A lot of the code stores the items for later, and using an iterator will
result in unhappiness when the data can't be iterated over more than once.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-03-04 01:34:55 +00:00
brian m. carlson
dc4a1b21e7
Add automatic record filtering.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-03-02 22:36:18 +00:00
brian m. carlson
c0405f126c
Remove duplicate test.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-17 02:54:15 +00:00
brian m. carlson
63345a969d
Prefer JSON over pickle.
This allows for better diffing, and it also makes it possible to load
untrusted data from the dtb file if that becomes necessary.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-14 02:58:47 +00:00
brian m. carlson
e753bf26f3
Add more database format tests.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-13 03:39:56 +00:00
brian m. carlson
3051df1650
Add the ability to upgrade to any given version.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-13 03:17:08 +00:00
brian m. carlson
d145cdb068
Add tests for compression version.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-13 03:05:18 +00:00
brian m. carlson
24f1e7728b
Add additional database tests.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-08 23:16:04 +00:00
brian m. carlson
8422918f6e
Verify that new databases meet strict validation.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-08 01:56:24 +00:00
brian m. carlson
061b98abaa
Verify that new database pass validation.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-07 02:14:17 +00:00
brian m. carlson
77712b3150
Add tests for upgrading databases.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-06 03:38:25 +00:00
brian m. carlson
eb67121630
Test what files are checked in to git.
As well as testing that all files are checked into git when using git
transactions, test that the files actually checked in are exactly the
expected ones.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-02-01 03:16:00 +00:00
brian m. carlson
ee2987f3fc
Implement lzma compression.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-28 00:31:57 +00:00
brian m. carlson
ed232bc6ba
Add support for xz compression.
This support isn't available in newfol proper, but filemanip does support
it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-26 02:57:54 +00:00
brian m. carlson
f85219647d
Add tests for the Singleton metaclass.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-22 02:27:21 +00:00
brian m. carlson
94a0b685d4
Implement support for autodetecting hashes.
The appropriate hash to use for validating the data is automatically
detected, and if no hash type is specified, use SHA-512 on 64-bit systems
and SHA-256 on 32-bit systems, as this provides the best performance.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 18:37:40 +00:00
brian m. carlson
082fd07c62
Generate testcases on the fly.
Use hashlib to generate the testcases instead of relying on hard-coded
values.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 18:15:00 +00:00
brian m. carlson
2a8c8d2d2a
Support SHA-384 and SHA-512.
Turn the SHA256Transaction store into a HashTransactionStore and support
SHA-384 and SHA-512, which provide better performance on 64-bit systems.
Don't support SHA-224 since it is weaker and is only useful where the hash
would be truncated anyway.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-11 00:58:54 +00:00
brian m. carlson
b3b76c7a57
Add helpful comments to unit test.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-09 02:08:04 +00:00
brian m. carlson
09d0d11751
Add more SHA-256 tests.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-09 01:57:46 +00:00
brian m. carlson
450bf7ff6a
Properly report open mode to transaction stores.
The mode was always being reported as "w" (write), which resulted in SHA-256
checksums not being validated on load.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-08 03:34:54 +00:00
brian m. carlson
3d39ca84e6
Silence ResourceWarning in tests.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-08 03:28:01 +00:00
brian m. carlson
41fef74e9d
Add more tests for SHA256TransactionStore.
One of the tests is a known failure because of a bug, so mark it accordingly.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-08 03:27:20 +00:00
brian m. carlson
e509dacc9a
Add a basic test for the SHA-256 Transaction store.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-05 19:29:21 +00:00
brian m. carlson
544fc064e9
filemanip: use reasonable committer ID for git.
We should not rely on the user setting up reasonable values for the committer
identification for git.  Use a committer name of newfol and an email address
consisting of the user's username and the FQDN of the machine.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-01 20:30:03 +00:00
brian m. carlson
a83ae0f348
database: add some tests for git transactions.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2014-01-01 20:02:21 +00:00
brian m. carlson
0d14ec597b
filemanip: add tests for YAML.
Since currently we can only serialize YAML, not load it, verify that it
serializes correctly twice.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2013-12-31 23:41:28 +00:00
brian m. carlson
cb17765453
Check that serialized data is stable.
Extend the filemanip tests to ensure that the data is serialized the same way
every time.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2013-12-31 23:38:25 +00:00
brian m. carlson
e560f273b0
Fix JSON round-tripping.
This also includes a unit test to ensure that round-tripping works properly for
those serializations where it's supported.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2013-11-16 23:08:13 +00:00
brian m. carlson
0263792fde
Update database test for new record version.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2013-11-16 02:17:59 +00:00
brian m. carlson
629aba310b
Add a test to ensure git transactions work.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
2013-11-16 02:16:19 +00:00