-
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.
feat: add remove_events cli command, add remove_events method to repo…
…sitories
- Loading branch information
Showing
10 changed files
with
223 additions
and
17 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
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
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
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,40 @@ | ||
import pytest | ||
|
||
from ckanext.event_audit.cli import export_data, remove_events | ||
|
||
|
||
class TestExportDataCLI: | ||
"""Test that we are able to export data to a file using the CLI.""" | ||
|
||
def test_exporter_doesnt_exist(self, cli): | ||
result = cli.invoke(export_data, ["xxx", "--start", "2024-1-1"]) | ||
|
||
assert "Exporter xxx not found" in result.output | ||
|
||
def test_csv_no_data(self, cli): | ||
result = cli.invoke(export_data, ["csv", "--start", "2024-1-1"]) | ||
|
||
assert result.output == "\n" | ||
|
||
def test_invalid_config_type(self, cli): | ||
result = cli.invoke( | ||
export_data, ["csv", "--start", "2024-1-1", "--config", "xxx"] | ||
) | ||
|
||
assert "Invalid JSON format for config" in result.output | ||
|
||
def test_invalid_exporter_config(self, cli): | ||
result = cli.invoke( | ||
export_data, ["csv", "--start", "2024-1-1", "--config", '{"xxx": "yyy"}'] | ||
) | ||
|
||
assert "got an unexpected keyword argument 'xxx'" in result.output | ||
assert "Invalid exporter config" in result.output | ||
|
||
def test_end_date_goes_before_start_date(self, cli): | ||
result = cli.invoke( | ||
export_data, | ||
["csv", "--start", "2024-1-2", "--end", "2024-1-1"], | ||
) | ||
|
||
assert "Start date must be before the end date" in result.output |
This file was deleted.
Oops, something went wrong.