Skip to content

Commit

Permalink
Readme updates (#9)
Browse files Browse the repository at this point in the history
* updated readme

* added vendor check to validate_vendor_files
  • Loading branch information
charlottekostelic authored Oct 30, 2024
1 parent 16d44aa commit b7056a2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ CLI tool to retrieve files from vendor servers.

## Usage
```
$ fetch all-available-records
$ fetch all-vendor-files
```

This project provides a command line interface to connect to and retrieve files from vendors using FTP/SFTP. Files are copied to the vendor's directory on BookOps' NSDROP SFTP server.
This project provides a command line interface to connect to and retrieve files from vendors using FTP/SFTP. Files are copied to the vendor's directory on BookOps' NSDROP SFTP server. Credentials are read from a local `yaml` file or environment variables.

This CLI can also validate MARC records using the models defined in [record-validator](https://github.com/BookOps-CAT/record-validator). Currently this tool is able to validate records for Eastview, Leila, and Amalivre (SASB).

Expand All @@ -36,7 +36,7 @@ The following information is also available using `validator --help`
##### Retrieve all new files
`$ fetch all-vendor-files`

Reads credentials for all vendor servers from a `yaml` file. Retrieves all new files for all vendors with credentials in the `yaml` file.
Retrieves all new files for all vendors with configured credentials.
- Logs into each vendor's server,
- Creates a lists of files on the server and in the corresponding directory on NSDROP,
- Copies all files from the vendor's server that are not in the NSDROP directory,
Expand All @@ -47,7 +47,7 @@ Reads credentials for all vendor servers from a `yaml` file. Retrieves all new f
##### List all vendors configured to work with CLI
`$ fetch available-vendors`

Reads the local `yaml` config file and prints the list of vendors who are configured to work with the CLI.
Prints a list of vendors with credentials configured to work with the CLI.

##### Validate vendor .mrc files
`$ fetch validate-file`
Expand Down
12 changes: 12 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,15 @@ def test_vendor_file_cli_validate_vendor_files(cli_runner, caplog):
assert result.exit_code == 0
assert "(NSDROP) Connecting to " in caplog.text
assert "(NSDROP) Validating eastview file: foo.mrc" in caplog.text


def test_vendor_file_cli_validate_vendor_files_invalid_vendor(cli_runner, caplog):
result = cli_runner.invoke(
cli=vendor_file_cli,
args=["validate-file", "-v", "foo", "-f", "foo.mrc"],
)
assert result.exit_code == 0
assert (
"Vendor not supported for validation."
"Only EASTVIEW, LEILA, and AMALIVRE_SASB supported." in result.stdout
)
6 changes: 6 additions & 0 deletions vendor_file_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ def validate_vendor_files(vendor: str, file: str) -> None:
Returns:
None
"""
if vendor.upper() not in ["EASTVIEW", "LEILA", "AMALIVRE_SASB"]:
click.echo(
"Vendor not supported for validation."
"Only EASTVIEW, LEILA, and AMALIVRE_SASB supported."
)
return
validate_files(vendor=vendor, files=[file])


Expand Down

0 comments on commit b7056a2

Please sign in to comment.