mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2025-09-28 06:35:24 +00:00
Basic test passing
This commit is contained in:
@@ -1,15 +1,43 @@
|
||||
import json
|
||||
import os
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from restic_volume_backup import utils
|
||||
import fixtures
|
||||
|
||||
list_containers_func = 'restic_volume_backup.utils.list_containers'
|
||||
|
||||
def list_containers():
|
||||
return {}
|
||||
|
||||
|
||||
@mock.patch('restic_volume_backup.utils.list_containers', list_containers)
|
||||
class ResticBackupTests(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Set up basic enviroment variables"""
|
||||
os.environ['RESTIC_REPOSITORY'] = "test"
|
||||
os.environ['RESTIC_PASSWORD'] = "password"
|
||||
|
||||
def test_stuff(self):
|
||||
assert utils.list_containers() == {}
|
||||
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))
|
||||
|
Reference in New Issue
Block a user