def test_main(): with mock.patch('sys.argv', ['dobackup', '--list-droplets']): assert dobackup.main() == 0 with mock.patch('sys.argv', ['dobackup', '--list-snaps']): assert dobackup.main() == 0 with mock.patch('sys.argv', ['dobackup', '--list-tags']): assert dobackup.main() == 0 with mock.patch('sys.argv', ['dobackup', '--list-backups']): assert dobackup.main() == 0 with mock.patch('sys.argv', ['dobackup', '--list-tagged']): assert dobackup.main() == 0 with mock.patch('sys.argv', ['dobackup', '--list-older-than', '7']): assert dobackup.main() == 0 with mock.patch('sys.argv', ['dobackup', '--tag-droplet', non_existing_droplet_id]): assert dobackup.main() == 1
def test_main(): with mock.patch("sys.argv", ["dobackup", "--list-droplets"]): assert dobackup.main() == 0 with mock.patch("sys.argv", ["dobackup", "--list-snaps"]): assert dobackup.main() == 0 with mock.patch("sys.argv", ["dobackup", "--list-tags"]): assert dobackup.main() == 0 with mock.patch("sys.argv", ["dobackup", "--list-backups"]): assert dobackup.main() == 0 with mock.patch("sys.argv", ["dobackup", "--list-tagged"]): assert dobackup.main() == 0 with mock.patch("sys.argv", ["dobackup", "--list-older-than", "7"]): assert dobackup.main() == 0 with mock.patch("sys.argv", ["dobackup", "--tag-droplet", non_existing_droplet_id]): assert dobackup.main() == 1
def test_powerup_wrong_id(): with mock.patch("sys.argv", ["dobackup", "--powerup", non_existing_droplet_id]): assert dobackup.main() == 1
def test_untag_droplet_wrong_id(): with mock.patch("sys.argv", ["dobackup", "--untag-droplet", non_existing_droplet_id]): assert dobackup.main() == 1
def test_tag_droplet_wrong_id(): with mock.patch('sys.argv', ['dobackup', '--tag-droplet', non_existing_droplet_id]): assert dobackup.main() == 1