123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- # -*- coding: utf-8 -*-
- from __future__ import absolute_import, print_function, unicode_literals
- import pytest
- from tests.support.case import ModuleCase
- @pytest.mark.windows_whitelisted
- class DataModuleTest(ModuleCase):
- """
- Validate the data module
- """
- def setUp(self):
- self.run_function("data.clear")
- self.addCleanup(self.run_function, "data.clear")
- @pytest.mark.slow_test(seconds=60) # Test takes >30 and <=60 seconds
- def test_load_dump(self):
- """
- data.load
- data.dump
- """
- self.assertTrue(self.run_function("data.dump", ['{"foo": "bar"}']))
- self.assertEqual(self.run_function("data.load"), {"foo": "bar"})
- @pytest.mark.slow_test(seconds=120) # Test takes >60 and <=120 seconds
- def test_get_update(self):
- """
- data.get
- data.update
- """
- self.assertTrue(self.run_function("data.update", ["spam", "eggs"]))
- self.assertEqual(self.run_function("data.get", ["spam"]), "eggs")
- self.assertTrue(self.run_function("data.update", ["unladen", "swallow"]))
- self.assertEqual(
- self.run_function("data.get", [["spam", "unladen"]]), ["eggs", "swallow"]
- )
- @pytest.mark.slow_test(seconds=60) # Test takes >30 and <=60 seconds
- def test_cas_update(self):
- """
- data.update
- data.cas
- data.get
- """
- self.assertTrue(self.run_function("data.update", ["spam", "eggs"]))
- self.assertTrue(self.run_function("data.cas", ["spam", "green", "eggs"]))
- self.assertEqual(self.run_function("data.get", ["spam"]), "green")
|