Skip to content

Commit

Permalink
added TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Shellyber committed Apr 13, 2020
1 parent 836af9e commit 677f75f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 10 additions & 6 deletions demisto_sdk/commands/common/tests/tools_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ def test_find_type(self, path, _type):

class TestGetRemoteFile:
def test_get_remote_file_sanity(self):
gmail_yml = tools.get_remote_file('Integrations/Gmail/Gmail.yml')
assert gmail_yml
assert gmail_yml['commonfields']['id'] == 'Gmail'
hello_world_yml = tools.get_remote_file('Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.yml')
assert hello_world_yml
assert hello_world_yml['commonfields']['id'] == 'HelloWorld'

def test_get_remote_file_origin(self):
gmail_yml = tools.get_remote_file('Integrations/Gmail/Gmail.yml', 'master')
assert gmail_yml
assert gmail_yml['commonfields']['id'] == 'Gmail'
hello_world_yml = tools.get_remote_file('Packs/HelloWorld/Integrations/HelloWorld/HelloWorld.yml', 'master')
assert hello_world_yml
assert hello_world_yml['commonfields']['id'] == 'HelloWorld'

def test_get_remote_md_file_origin(self):
hello_world_readme = tools.get_remote_file('Packs/HelloWorld/README.md', 'master')
assert hello_world_readme == {}

def test_get_remote_file_tag(self):
gmail_yml = tools.get_remote_file('Integrations/Gmail/Gmail.yml', '19.10.0')
Expand Down
6 changes: 4 additions & 2 deletions demisto_sdk/commands/common/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ def get_remote_file(full_file_path, tag='master'):

if full_file_path.endswith('json'):
details = json.loads(res.content)
else:
elif full_file_path.endswith('yml'):
details = yaml.safe_load(res.content)

# if neither yml nor json then probably a CHANGELOG or README file.
else:
details = {}
return details


Expand Down

0 comments on commit 677f75f

Please sign in to comment.