# Path: ice/backups.py
# def default_backups_directory():
# def backup_filename(user, timestamp_format):
# def shortcuts_backup_path(directory, user, timestamp_format="%Y%m%d%H%M%S"):
# def backup_directory(config):
# def create_backup_of_shortcuts(config, user, dry_run=False):
#   def _create_directory_if_needed(directory):
# 
# Path: ice/paths.py
# def application_data_directory():
# def data_file_path(filename):
# def archive_path():
# def log_file_location():
# def default_roms_directory():


import os
import shutil
import tempfile
import unittest
from mockito import *
from nose_parameterized import parameterized
from pysteam import model
from pysteam import shortcuts
from ice import backups
from ice import paths
from testinfra import fixtures

    user = self.user_fixture.get_context()

    expected_dir = backups.default_backups_directory()
    expected_location = backups.shortcuts_backup_path(expected_dir, user)

    self.assertFalse(os.path.exists(expected_location))
    backups.create_backup_of_shortcuts(config, user)
    self.assertFalse(os.path.exists(expected_location))

  def test_create_backup_of_shortcuts_creates_directory_if_it_doesnt_exist(self):
    tempdir = tempfile.mkdtemp()
    backup_dir = os.path.join(tempdir, "Backups")

    config = mock()
    config.backup_directory = backup_dir

    user = self.user_fixture.get_context()

    self.assertFalse(os.path.exists(backup_dir))
    backups.create_backup_of_shortcuts(config, user)
    self.assertTrue(os.path.exists(backup_dir))

    shutil.rmtree(tempdir)

  def test_create_backup_of_shortcuts_creates_copy_of_shortcuts_at_backup_path(self):
    tempdir = tempfile.mkdtemp()
    backup_dir = os.path.join(tempdir, "Backups")

    config = mock()

# Path: ice/backups.py
# def default_backups_directory():
# def backup_filename(user, timestamp_format):
# def shortcuts_backup_path(directory, user, timestamp_format="%Y%m%d%H%M%S"):
# def backup_directory(config):
# def create_backup_of_shortcuts(config, user, dry_run=False):
#   def _create_directory_if_needed(directory):
# 
# Path: ice/paths.py
# def application_data_directory():
# def data_file_path(filename):
# def archive_path():
# def log_file_location():
# def default_roms_directory():


# Path: tests/backups_tests.py
import os
import shutil
import tempfile
import unittest
from mockito import *
from nose_parameterized import parameterized
from pysteam import model
from pysteam import shortcuts
from ice import backups
from ice import paths
from testinfra import fixtures


    user = self.user_fixture.get_context()

    expected_dir = backups.default_backups_directory()
    expected_location = backups.shortcuts_backup_path(expected_dir, user)

    self.assertFalse(os.path.exists(expected_location))
    backups.create_backup_of_shortcuts(config, user)
    self.assertFalse(os.path.exists(expected_location))

  def test_create_backup_of_shortcuts_creates_directory_if_it_doesnt_exist(self):
    tempdir = tempfile.mkdtemp()
    backup_dir = os.path.join(tempdir, "Backups")

    config = mock()
    config.backup_directory = backup_dir

    user = self.user_fixture.get_context()

    self.assertFalse(os.path.exists(backup_dir))
    backups.create_backup_of_shortcuts(config, user)
    self.assertTrue(os.path.exists(backup_dir))

    shutil.rmtree(tempdir)

  def test_create_backup_of_shortcuts_creates_copy_of_shortcuts_at_backup_path(self):
    tempdir = tempfile.mkdtemp()
    backup_dir = os.path.join(tempdir, "Backups")

    config = mock()

    config.backup_directory = backup_dir