import os

from sunpy import config
from sunpy.util.config import get_and_create_sample_dir, get_and_create_download_dir

USER = os.path.expanduser('~')


def test_get_and_create_download_dir():
    # test default config
    path = get_and_create_download_dir()
    assert path == os.path.join(USER, 'sunpy', 'data')
    # test updated config
    new_path = os.path.join(USER, 'data_here_please')
    config.set('downloads', 'download_dir', new_path)
    path = get_and_create_download_dir()
    assert path == os.path.join(USER, new_path)


def test_get_and_create_sample_dir():
    # test default config
    path = get_and_create_sample_dir()
    assert path == os.path.join(USER, 'sunpy', 'data', 'sample_data')
    # test updated config
    new_path = os.path.join(USER, 'data_here_please')
    config.set('downloads', 'sample_dir', new_path)
    path = get_and_create_sample_dir()
    assert path == new_path

@@ -533,16 +533,123 @@
 w_path)%0A
+    # Set the config back%0A    config.set('downloads', 'download_dir', os.path.join(USER, 'sunpy', 'data'))%0A
 %0A%0Adef te
@@ -1014,8 +1014,130 @@
 ew_path%0A
+    # Set the config back%0A    config.set('downloads', 'download_dir', os.path.join(USER, 'sunpy', 'data', 'sample_data'))%0A

reset config in test