|
9 | 9 | from pkg_resources import resource_string
|
10 | 10 | from unittest import TestCase
|
11 | 11 |
|
| 12 | +import requests |
12 | 13 | from nose.plugins.attrib import attr
|
13 | 14 |
|
14 | 15 | from plotly import files, graph_reference as gr, tools, utils
|
@@ -57,6 +58,25 @@ def test_get_graph_reference_bad_request_no_copy(self):
|
57 | 58 | graph_reference = gr.get_graph_reference()
|
58 | 59 | self.assertEqual(graph_reference, default_graph_reference)
|
59 | 60 |
|
| 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 | + |
60 | 80 |
|
61 | 81 | class TestStringToClass(PlotlyTestCase):
|
62 | 82 |
|
|
0 commit comments