def test_get_config_no_cache_elem(self): s = MemoryKeyValueStore() s._cache_element = None # We expect an default DataElement config (no impl type defined) c = s.get_config() self.assertIn('cache_element', c) self.assertIsNone(c['cache_element']['type'])
def test_get_config_no_cache_elem(self): """ Test that configuration returned reflects no cache element being set. """ s = MemoryKeyValueStore() s._cache_element = None # We expect an default DataElement config (no impl type defined) c = s.get_config() self.assertIn('cache_element', c) self.assertIsNone(c['cache_element']['type'])
def test_get_config_mem_cache_elem(self): s = MemoryKeyValueStore() s._cache_element = DataMemoryElement('someBytes', 'text/plain', False) expected_config = { 'cache_element': { "DataMemoryElement": { 'bytes': 'someBytes', 'content_type': 'text/plain', 'readonly': False, }, 'type': 'DataMemoryElement' } } nose.tools.assert_equal(s.get_config(), expected_config)
def test_get_config_mem_cache_elem(self): """ Test that configuration returned reflects the cache element that is set. """ s = MemoryKeyValueStore() s._cache_element = DataMemoryElement(six.b('someBytes'), 'text/plain', False) expected_config = {'cache_element': { "DataMemoryElement": { 'bytes': six.b('someBytes'), 'content_type': 'text/plain', 'readonly': False, }, 'type': 'DataMemoryElement' }} self.assertEqual(s.get_config(), expected_config)
def test_get_config_mem_cache_elem(self): """ Test that configuration returned reflects the cache element that is set. """ s = MemoryKeyValueStore() s._cache_element = DataMemoryElement(b'someBytes', 'text/plain', readonly=False) dme_key = 'smqtk.representation.data_element.memory_element.DataMemoryElement' expected_config = { 'cache_element': { dme_key: { 'bytes': 'someBytes', 'content_type': 'text/plain', 'readonly': False, }, 'type': dme_key } } self.assertEqual(s.get_config(), expected_config)
def test_get_config_no_cache_elem(self): s = MemoryKeyValueStore() s._cache_element = None expected_config = {'cache_element': None} nose.tools.assert_equal(s.get_config(), expected_config)