restic-compose-backup/tests/tests.py

44 lines
1.1 KiB
Python
Raw Normal View History

2019-04-16 00:57:06 +00:00
import json
import os
2019-04-15 17:07:14 +00:00
import unittest
from unittest import mock
from restic_volume_backup import utils
2019-04-16 00:57:06 +00:00
import fixtures
2019-04-15 17:07:14 +00:00
2019-04-16 00:57:06 +00:00
list_containers_func = 'restic_volume_backup.utils.list_containers'
2019-04-15 17:07:14 +00:00
class ResticBackupTests(unittest.TestCase):
2019-04-16 00:57:06 +00:00
@classmethod
def setUpClass(cls):
"""Set up basic enviroment variables"""
os.environ['RESTIC_REPOSITORY'] = "test"
os.environ['RESTIC_PASSWORD'] = "password"
2019-04-15 17:07:14 +00:00
def test_stuff(self):
2019-04-16 00:57:06 +00:00
containers = [
{
'service': 'web',
'labels': {
'moo': 1,
},
'mounts': [{
'Source': 'moo',
'Destination': 'moo',
'Type': 'bind',
}]
},
{
'service': 'mysql',
},
{
'service': 'postgres',
},
]
with mock.patch(list_containers_func, fixtures.containers(containers=containers)):
test = utils.list_containers()
# raise ValueError(json.dumps(test, indent=2))