forked from podaac/data-subscriber
-
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.
added token get,delete, refresh and list operations
- Loading branch information
1 parent
9680163
commit 15aba90
Showing
2 changed files
with
102 additions
and
19 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
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,49 @@ | ||
import pytest | ||
import os | ||
from os.path import exists | ||
|
||
from subscriber import podaac_access as pa | ||
import shutil | ||
from pathlib import Path | ||
|
||
|
||
def setup_module(module): | ||
print('*****SETUP*****') | ||
tokens = pa.list_tokens(pa.token_url) | ||
for x in tokens: | ||
pa.delete_token(pa.token_url, x) | ||
|
||
def teardown_module(module): | ||
print('*****TEARDOWN*****') | ||
tokens = pa.list_tokens(pa.token_url) | ||
for x in tokens: | ||
pa.delete_token(pa.token_url, x) | ||
|
||
# REGRESSION TEST CURRENTLY REQUIRES A .NETRC file for CMR/Data Download | ||
# token API can be found here: https://wiki.earthdata.nasa.gov/display/EL/API+Documentation | ||
def test_list_tokens(): | ||
tokens = pa.list_tokens(pa.token_url) | ||
for x in tokens: | ||
pa.delete_token(pa.token_url, x) | ||
|
||
def test_edl_getToken(): | ||
token = pa.get_token(pa.token_url) | ||
assert token != "" | ||
token = pa.refresh_token(token) | ||
assert token != "" | ||
tokens = pa.list_tokens(pa.token_url) | ||
|
||
assert len(tokens) == 1 | ||
for x in tokens: | ||
assert x != "" | ||
|
||
assert True == pa.delete_token(pa.token_url, token) | ||
|
||
def test_edl_max_token(): | ||
#call this 3 times since we're capped out at 2 total... | ||
token = pa.get_token(pa.token_url) | ||
assert token != "" | ||
token = pa.get_token(pa.token_url) | ||
assert token != "" | ||
token = pa.get_token(pa.token_url) | ||
assert token != "" |