forked from ericaltendorf/plotman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive_test.py
executable file
·32 lines (25 loc) · 1.01 KB
/
archive_test.py
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
#!/usr/bin/python3
from unittest.mock import patch
import unittest
import archive
import manager
class TestArchive(unittest.TestCase):
def test_compute_priority(self):
self.assertGreater(
archive.compute_priority( (3, 1), 1000, 10),
archive.compute_priority( (3, 6), 1000, 10) )
def test_rsync_dest(self):
arch_dir = '/plotdir/012'
arch_cfg = { 'rsyncd_module': 'plots_mod',
'rsyncd_path' : '/plotdir',
'rsyncd_host' : 'thehostname',
'rsyncd_user' : 'theusername' }
# Normal usage
self.assertEqual('rsync://theusername@thehostname:12000/plots_mod/012',
archive.rsync_dest(arch_cfg, arch_dir))
# Usage for constructing just the prefix, for scanning process tables
# for matching jobs.
self.assertEqual('rsync://theusername@thehostname:12000/',
archive.rsync_dest(arch_cfg, '/'))
if __name__ == '__main__':
unittest.main()