forked from stackify/stackify-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbases.py
More file actions
30 lines (26 loc) · 805 Bytes
/
bases.py
File metadata and controls
30 lines (26 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import unittest
import retrying
class ClearEnvTest(unittest.TestCase):
'''
This class clears the environment variables that the
library uses for clean testing.
'''
def setUp(self):
# if you have these specified in the environment it will break tests
to_save = [
'STACKIFY_APPLICATION',
'STACKIFY_ENVIRONMENT',
'STACKIFY_API_KEY',
'STACKIFY_API_URL',
]
self.saved = {}
for key in to_save:
if key in os.environ:
self.saved[key] = os.environ[key]
del os.environ[key]
def tearDown(self):
# restore deleted environment variables
for key, item in self.saved.items():
os.environ[key] = item
del self.saved