Skip to content

Commit

Permalink
Merge pull request #408 from OliverCullimore/406-replace-schema-files
Browse files Browse the repository at this point in the history
  • Loading branch information
robbrad authored Oct 31, 2023
2 parents be0f5c5 + 2ed11be commit 508410f
Show file tree
Hide file tree
Showing 101 changed files with 13 additions and 4,165 deletions.
70 changes: 1 addition & 69 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* [Additional files](#additional-files)
+ [Input JSON file](#input-json-file)
+ [Output JSON file](#output-json-file)
+ [Council schema](#council-schema)
+ [Feature file](#feature-file)
* [Testing](#testing)
+ [Behave (Integration Testing)](#behave--integration-testing-)
Expand Down Expand Up @@ -146,7 +145,6 @@ In order for your scraper to work with the project's testing suite, some additio
modified:
- [ ] [Input JSON file](#input-json-file)
- [ ] [Output JSON file](#output-json-file)
- [ ] [Council Schema](#council-schema)
- [ ] [Feature file](#feature-file)

**Note:** from here on, anything containing`<council_name>` should be replaced with the scraper's name.
Expand Down Expand Up @@ -221,72 +219,6 @@ Adding the `-d` or `--dev_mode` parameter to your CLI command enables developmen
```
</details>

### Council schema
| Type | File location |
|------|-------------------------------------------------------------------------------------|
| Add | `UKBinCollectionData/uk_bin_collection/tests/council_schemas/<council_name>.schema` |

Using the above [output](#output-json-file), you will need to generate a JSON schema that the integration test can run
against. Luckily, this is pretty easy and can be done using an [online tool](https://jsonformatter.org/json-to-jsonschema).

**Note:** due to seasonal collections (entirely dependent on council, of course), the schema may not include all bin types.
If this is the case, you may need to add them to the bin_type `enum` manually (usually around the end of the file).

<details>
<summary>Example</summary>

```json
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Welcome10",
"definitions": {
"Welcome10": {
"type": "object",
"additionalProperties": false,
"properties": {
"bins": {
"type": "array",
"items": {
"$ref": "#/definitions/Bin"
}
}
},
"required": [
"bins"
],
"title": "Welcome10"
},
"Bin": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"$ref": "#/definitions/Type"
},
"collectionDate": {
"type": "string"
}
},
"required": [
"collectionDate",
"type"
],
"title": "Bin"
},
"Type": {
"type": "string",
"enum": [
"Empty Standard Mixed Recycling",
"Empty Standard Garden Waste",
"Empty Standard General Waste"
],
"title": "Type"
}
}
}
```
</details>

### Feature file
| Type | File location |
|--------|-----------------------------------------------------------------------------------------|
Expand All @@ -304,7 +236,7 @@ of "what works and what needs work" - we have created a set of Integration tests
file.

Based on the [input.json](https://github.com/robbrad/UKBinCollectionData/blob/master/uk_bin_collection/tests/input.json),
this does an actual live run against the council's site and validates if the returned data is JSON and conforms to a [JSON Schema](https://github.com/robbrad/UKBinCollectionData/tree/master/uk_bin_collection/tests/council_schemas) for that council.
this does an actual live run against the council's site and validates if the returned data is JSON and conforms to the common format [JSON Schema](https://github.com/robbrad/UKBinCollectionData/tree/master/uk_bin_collection/tests/output.schema).


#### Running the Behave tests
Expand Down

This file was deleted.

39 changes: 0 additions & 39 deletions uk_bin_collection/tests/council_schemas/BCPCouncil.schema

This file was deleted.

50 changes: 0 additions & 50 deletions uk_bin_collection/tests/council_schemas/BasingstokeCouncil.schema

This file was deleted.

This file was deleted.

50 changes: 0 additions & 50 deletions uk_bin_collection/tests/council_schemas/BexleyCouncil.schema

This file was deleted.

39 changes: 0 additions & 39 deletions uk_bin_collection/tests/council_schemas/BoltonCouncil.schema

This file was deleted.

Loading

0 comments on commit 508410f

Please sign in to comment.