-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba7738c
commit 17c01dd
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import shutil | ||
import stat | ||
|
||
from bgcval2.download_from_mass import download_from_mass as dfm | ||
|
||
|
||
def test_allowed_user(): | ||
dfm(jobID="u-xxx", | ||
doMoo=False, | ||
auto_download=False, | ||
config_user="defaults" | ||
) | ||
user_home = os.path.expanduser('~') | ||
output_folder = "bgcval2/local_test/BGC_data/u-xxx/" | ||
run_dir = os.path.join(user_home, output_folder) | ||
assert os.stat(run_dir).st_mode == 16893 | ||
|
||
|
||
def test_disallowed_user(): | ||
user_home = os.path.expanduser('~') | ||
output_folder = "bgcval2/local_test/BGC_data/u-xxx/" | ||
run_dir = os.path.join(user_home, output_folder) | ||
st = os.stat(run_dir) | ||
os.chmod(run_dir, False) | ||
dfm(jobID="u-xxx", | ||
doMoo=False, | ||
auto_download=False, | ||
config_user="defaults" | ||
) | ||
assert os.stat(run_dir).st_mode == 16384 | ||
shutil.rmtree(run_dir, ignore_errors=True) |