Skip to content

Commit 1746477

Browse files
committed
Add a test to force us to update default schema!
1 parent 095b9da commit 1746477

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

plotly/tests/test_core/test_graph_reference/test_graph_reference.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pkg_resources import resource_string
1010
from unittest import TestCase
1111

12+
import requests
1213
from nose.plugins.attrib import attr
1314

1415
from plotly import files, graph_reference as gr, tools, utils
@@ -57,6 +58,25 @@ def test_get_graph_reference_bad_request_no_copy(self):
5758
graph_reference = gr.get_graph_reference()
5859
self.assertEqual(graph_reference, default_graph_reference)
5960

61+
@attr('slow')
62+
def test_default_schema_is_up_to_date(self):
63+
api_domain = files.FILE_CONTENT[files.CONFIG_FILE]['plotly_api_domain']
64+
graph_reference_url = '{}{}?sha1'.format(api_domain,
65+
gr.GRAPH_REFERENCE_PATH)
66+
response = requests.get(graph_reference_url)
67+
schema = json.loads(response.content)['schema']
68+
69+
path = os.path.join('graph_reference', 'default-schema.json')
70+
s = resource_string('plotly', path).decode('utf-8')
71+
default_schema = json.loads(s)
72+
73+
msg = (
74+
'The default, hard-coded plot schema we ship with pip is out of '
75+
'sync with the prod plot schema!\n'
76+
'Run `make update_default_schema` to fix it!'
77+
)
78+
self.assertEqual(schema, default_schema, msg=msg)
79+
6080

6181
class TestStringToClass(PlotlyTestCase):
6282

0 commit comments

Comments
 (0)