Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Replace individual council schema's with a single common one #408

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading