-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from nasa/release/0.6.0
Release/0.6.0
- Loading branch information
Showing
7 changed files
with
158 additions
and
9 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,36 @@ | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }} |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .queries import GranuleQuery, CollectionQuery | ||
from .queries import GranuleQuery, CollectionQuery, ToolQuery, ServiceQuery, VariableQuery | ||
|
||
__all__ = ["GranuleQuery", "CollectionQuery"] | ||
__all__ = ["GranuleQuery", "CollectionQuery", "ToolQuery", "ServiceQuery", "VariableQuery"] |
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
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,71 @@ | ||
import unittest | ||
|
||
from cmr.queries import VariableQuery | ||
|
||
class TestVariableClass(unittest.TestCase): | ||
|
||
def test_name(self): | ||
query = VariableQuery() | ||
query.name("name") | ||
|
||
self.assertIn("name", query.params) | ||
self.assertEqual(query.params["name"], "name") | ||
|
||
def test_provider(self): | ||
query = VariableQuery() | ||
query.provider("provider") | ||
|
||
self.assertIn("provider", query.params) | ||
self.assertEqual(query.params["provider"], "provider") | ||
|
||
def test_native_id(self): | ||
query = VariableQuery() | ||
query.native_id("native_id") | ||
|
||
self.assertIn("native_id", query.params) | ||
self.assertEqual(query.params["native_id"], ["native_id"]) | ||
|
||
def test_native_ids(self): | ||
query = VariableQuery() | ||
query.native_id(["native_id1", "native_id2"]) | ||
|
||
self.assertIn("native_id", query.params) | ||
self.assertEqual(query.params["native_id"], ["native_id1", "native_id2"]) | ||
|
||
def test_valid_formats(self): | ||
query = VariableQuery() | ||
formats = [ | ||
"json", "xml", "echo10", "iso", "iso19115", | ||
"csv", "atom", "kml", "native", "dif", "dif10", | ||
"opendata", "umm_json", "umm_json_v1_1" "umm_json_v1_9"] | ||
|
||
for _format in formats: | ||
query.format(_format) | ||
self.assertEqual(query._format, _format) | ||
|
||
def test_invalid_format(self): | ||
query = VariableQuery() | ||
|
||
with self.assertRaises(ValueError): | ||
query.format("invalid") | ||
query.format("jsonn") | ||
query.format("iso19116") | ||
|
||
def test_valid_concept_id(self): | ||
query = VariableQuery() | ||
|
||
query.concept_id("V1299783579-LPDAAC_ECS") | ||
self.assertEqual(query.params["concept_id"], ["V1299783579-LPDAAC_ECS"]) | ||
|
||
query.concept_id(["V1299783579-LPDAAC_ECS", "V1441380236-PODAAC"]) | ||
self.assertEqual(query.params["concept_id"], ["V1299783579-LPDAAC_ECS", "V1441380236-PODAAC"]) | ||
|
||
def test_invalid_concept_id(self): | ||
query = VariableQuery() | ||
|
||
with self.assertRaises(ValueError): | ||
query.concept_id("G1327299284-LPDAAC_ECS") | ||
|
||
with self.assertRaises(ValueError): | ||
query.concept_id(["C1299783579-LPDAAC_ECS", "G1327299284-LPDAAC_ECS"]) | ||
|