Skip to content

Commit

Permalink
Merge branch 'develop' into chore/rename-to-main
Browse files Browse the repository at this point in the history
  • Loading branch information
macintoshpie committed Mar 19, 2021
2 parents 40fe64a + 5ea1b82 commit 94515f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion seed/building_sync/tests/test_validation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import json

from config.settings.common import BASE_DIR
from seed.building_sync.validation_client import validate_use_case, DEFAULT_USE_CASE
from seed.building_sync.validation_client import validate_use_case, DEFAULT_USE_CASE, DEFAULT_SCHEMA_VERSION


def responseFactory(status_code, body_dict):
Expand All @@ -32,6 +32,7 @@ def setUp(self):
def test_validation_single_file_ok(self):
good_body = {
'success': True,
'schema_version': DEFAULT_SCHEMA_VERSION,
'validation_results': {
'schema': {
'valid': True
Expand All @@ -54,6 +55,7 @@ def test_validation_single_file_ok(self):
def test_validation_zip_file_ok(self):
good_body = {
'success': True,
'schema_version': DEFAULT_SCHEMA_VERSION,
'validation_results': [
{
'file': 'file1.xml',
Expand Down Expand Up @@ -111,6 +113,7 @@ def test_validation_fails_when_one_file_has_bad_schema(self):

body = {
'success': True,
'schema_version': DEFAULT_SCHEMA_VERSION,
'validation_results': [
{
'file': 'file1.xml',
Expand Down Expand Up @@ -156,6 +159,7 @@ def test_validation_fails_when_one_file_fails_use_case(self):

body = {
'success': True,
'schema_version': DEFAULT_SCHEMA_VERSION,
'validation_results': [
{
'file': 'file1.xml',
Expand Down Expand Up @@ -185,6 +189,7 @@ def test_validation_fails_when_one_file_fails_use_case(self):
def test_validation_zip_file_ok_when_warnings(self):
good_body = {
'success': True,
'schema_version': DEFAULT_SCHEMA_VERSION,
'validation_results': [
{
'file': 'file1.xml',
Expand Down
4 changes: 2 additions & 2 deletions seed/building_sync/validation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ def validate_use_case(file_, filename=None, schema_version=DEFAULT_SCHEMA_VERSIO
)

if response_body.get('success', False) is not True:
ValidationClientException(
raise ValidationClientException(
f"Selection Tool request was not successful: {response.text}",
)

response_schema_version = response_body.get('schema_version')
if response_schema_version != schema_version:
ValidationClientException(
raise ValidationClientException(
f"Expected schema_version to be '{schema_version}' but it was '{response_schema_version}'",
)

Expand Down

0 comments on commit 94515f9

Please sign in to comment.