8000 Config file safe tests by theengineear · Pull Request #261 · plotly/plotly.py · GitHub
[go: up one dir, main page]

Skip to content

Config file safe tests #261

8000
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

Merged
merged 5 commits into from
Jul 16, 2015
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Specify file for credentials and config.
About to add session stashing, so it’s helpful to specify which
credentials/config we’re stashing/restoring.
  • Loading branch information
theengineear committed Jul 15, 2015
commit 145e290cb712c77a8646d183979ebf6d0b53dbc8
24 changes: 12 additions & 12 deletions plotly/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ class PlotlyTestCase(TestCase):
# parent test case to assist with clean up of local credentials/config

def __init__(self, **kwargs):
self._credentials = None
self._config = None
self._file_credentials = None
self._file_config = None
super(PlotlyTestCase, self).__init__(**kwargs)

def setUp(self):
self.stash_credentials_and_config()
self.stash_file_credentials_and_config()

def tearDown(self):
self.restore_credentials_and_config()
self.restore_file_credentials_and_config()

def stash_credentials_and_config(self):
def stash_file_credentials_and_config(self):
if _file_permissions:
with open(CREDENTIALS_FILE, 'r') as f:
self._credentials = json.load(f)
self._file_credentials = json.load(f)
with open(CONFIG_FILE, 'r') as f:
self._config = json.load(f)
self._file_config = json.load(f)

def restore_credentials_and_config(self):
def restore_file_credentials_and_config(self):
if _file_permissions:
if self._credentials is not None:
if self._file_credentials is not None:
with open(CREDENTIALS_FILE, 'w') as f:
json.dump(self._credentials, f)
if self._config is not None:
json.dump(self._file_credentials, f)
if self._file_config is not None:
with open(CONFIG_FILE, 'w') as f:
json.load(self._config, f)
json.load(self._file_config, f)


def compare_dict(dict1, dict2, equivalent=True, msg='', tol=10e-8):
Expand Down
0