-
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.
Merge pull request #3 from climatepolicyradar/feature/pdct-1397-map-c…
…ollection-to-new-json-structure Feature/pdct 1397 map collection to new json structure
- Loading branch information
Showing
4 changed files
with
52 additions
and
18 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 |
---|---|---|
@@ -1,13 +1,31 @@ | ||
import sys | ||
|
||
import click | ||
|
||
|
||
@click.command() | ||
@click.option("--name", required=True, help="The name to greet.") | ||
@click.version_option("0.1.0", "--version", "-v", help="Show the version and exit.") | ||
def greet(name): | ||
"""Simple program that greets NAME.""" | ||
click.echo(f"Hello {name}!") | ||
def wrangle_json(): | ||
"""Simple program that wrangles GCF data into bulk import format.""" | ||
click.echo("🚀 Starting the GCF data mapping process.") | ||
|
||
try: | ||
collection() | ||
except Exception as e: | ||
click.echo(f"❌ Failed to map GCF data to expected JSON. Error: {e}.") | ||
sys.exit(1) | ||
|
||
click.echo("✅ Finished mapping GCF data.") | ||
|
||
|
||
def collection(): | ||
"""Map the GCF collection info to new structure. | ||
Collection information is not currently available for GCF data, so | ||
we will leave this function as not implemented for now. | ||
""" | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
greet() | ||
wrangle_json() |
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,8 +1,8 @@ | ||
[tool.poetry] | ||
name = "gcf-data-mapper" | ||
version = "0.1.0" | ||
description = "A simple CLI tool to greet by name." | ||
authors = ["Your Name <[email protected]>"] | ||
version = "0.1.1" | ||
description = "A CLI tool to wrangle GCF data into format recognised by the bulk-import tool." | ||
authors = ["CPR-dev-team <[email protected]>"] | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
packages = [{ include = "gcf_data_mapper" }] | ||
|
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,26 @@ | ||
import pytest | ||
from click.testing import CliRunner | ||
|
||
from gcf_data_mapper.cli import wrangle_json | ||
|
||
|
||
def test_version(): | ||
runner = CliRunner() | ||
result = runner.invoke(wrangle_json, ["--version"]) | ||
assert result.exit_code == 0 | ||
assert "version" in result.output.strip() | ||
|
||
|
||
@pytest.mark.skip() | ||
def test_wrangle_json_fail(): | ||
runner = CliRunner() | ||
result = runner.invoke(wrangle_json) | ||
assert result.exit_code == 1 | ||
assert "Failed to map GCF data to expected JSON" in result.output.strip() | ||
|
||
|
||
def test_wrangle_json_success(): | ||
runner = CliRunner() | ||
result = runner.invoke(wrangle_json) | ||
assert result.exit_code == 0 | ||
assert "Finished mapping GCF data." in result.output.strip() |
This file was deleted.
Oops, something went wrong.