Skip to content

Commit

Permalink
Add tests for the data module
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch45 committed Mar 28, 2012
1 parent 68b950e commit 118c028
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tests/integration/modules/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Import salt libs
import integration

class DataModuleTest(integration.ModuleCase):
'''
Validate the data module
'''
def _clear_db(self):
'''
Clear out the database
'''
self.run_function('data.clear')

def test_load_dump(self):
'''
data.load
data.dump
'''
self._clear_db()
self.assertTrue(self.run_function('data.dump', ['{"foo": "bar"}']))
self.assertEqual(self.run_function('data.load'), {'foo': 'bar'})
self._clear_db()

def test_get_update(self):
'''
data.getval
data.update
data.getvals
'''
self._clear_db()
self.assertTrue(
self.run_function(
'data.update',
['spam', 'eggs']
)
)
self.assertEqual(
self.run_function(
'data.getval',
['spam']
),
'eggs'
)
self.assertTrue(
self.run_function(
'data.update',
['unladen', 'swallow']
)
)
self.assertEqual(
self.run_function(
'data.getvals',
['["spam", "unladen"]']
),
['eggs', 'swallow']
)
self._clear_db()

0 comments on commit 118c028

Please sign in to comment.