Skip to content

Commit

Permalink
Adding information on test requirements
Browse files Browse the repository at this point in the history
Refactor json tests
Remove some unneeded test files
Add tests for the specific example of the default population failure

Update DJORNL stored queries to a ref structure that will work when populating defaults

Remove comments from file
  • Loading branch information
ialarmedalien committed Sep 10, 2020
1 parent 53ad1bb commit 1c5bbea
Show file tree
Hide file tree
Showing 31 changed files with 503 additions and 365 deletions.
2 changes: 2 additions & 0 deletions importers/test/test_djornl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
At the present time, this just ensures that the files are parsed correctly;
it does not check data loading into the db.
These tests run within the re_api docker image.
"""
import json
import unittest
Expand Down
4 changes: 2 additions & 2 deletions relation_engine_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Example response:
Get the schema for a specific data source

```sh
GET "{root_url}/api/v1/specs/data_source?name=ncbi_taxonomy"
GET "{root_url}/api/v1/specs/data_sources?name=ncbi_taxonomy"
```

Example response:
Expand Down Expand Up @@ -338,7 +338,7 @@ Example response:
Get the schema for a specific stored query

```sh
GET "{root_url}/api/v1/specs/stored_query?name=ncbi_fetch_taxon"
GET "{root_url}/api/v1/specs/stored_queries?name=ncbi_fetch_taxon"
```

Example response:
Expand Down
9 changes: 9 additions & 0 deletions relation_engine_server/test/data/json_validation/fruit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$schema: "http://json-schema.org/draft-07/schema#"
name: fruit
type: string
oneOf:
- const: peach
- const: plum
- const: dragonfruit
- const: strawberry
- const: pear
13 changes: 13 additions & 0 deletions relation_engine_server/test/data/json_validation/fruits_array.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$schema: "http://json-schema.org/draft-07/schema#"
name: fruits_array
definitions:
fruits:
type: array
items:
$ref: fruit.yaml
default: []
uniqueItems: true
examples:
- ['peach', 'plum']
- ['strawberry']
- []

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
"fruits": {
"type": "array",
"items": {
"type": "string"
}
"$ref": "fruit.yaml"
},
"default": [],
"uniqueItems": "true"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ properties:
fruits:
type: array
items:
type: string
$ref: fruit.yaml
default: []
uniqueItems: true
examples:
- ['peach', 'plum']
- ['strawberry']
- []

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: valid_uri
distance: 3
home_page: "http://json-validation.com:5000/this/is/valid"
home_page: http://json-validation.com:5000/this/is/valid
20 changes: 17 additions & 3 deletions relation_engine_server/test/spec_release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@

`sample_spec_release`, and the corresponding archive, `spec.tar.gz`, contain a set of sample schema files suitable for use in tests.

To create a new version of `spec.tar.gz`, you will need to exec into the `re_api` docker image to ensure that the new archive and its contents have the appropriate file owner and permissions (all files must have owner and group `root`/`root`).
To create a new version of `spec.tar.gz`, you will need to open a shell into the `re_api` docker image and create the new archive there to ensure that the new archive and its contents have the appropriate file owner and permissions (all files must have owner and group `root`/`root`).

Example commands:
Ensure that you have mounted your current working directory as `/app` in the docker `re_api` image by uncommenting the lines in `docker-compose.yaml`:

``` yaml
re_api:
( ... )
# uncomment to mount local directories
volumes:
- ${PWD}:/app
```
Run `make shell` to start up the docker container, and then get the ID of the current `re_api` image. Exec into the `re_api` image via the Docker Desktop client or the command line:

``` sh
$ docker exec -it relation_engine_re_api_run_1234567890 sh
# # in the docker image
```

Example commands for updating `spec.tar.gz`:

``` sh
# cd relation_engine_server/test/spec_release
# # ... perform any edits ...
# tar -czvf new_spec.tar.gz sample_spec_release/
Expand Down
2 changes: 1 addition & 1 deletion relation_engine_server/test/test_api_v1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Simple integration tests on the API itself.
We make actual ajax requests to the running docker container.
These tests run within the re_api docker image, and require access to the ArangoDB, auth, and workspace images.
"""
import unittest
import requests
Expand Down
Loading

0 comments on commit 1c5bbea

Please sign in to comment.