def test_load_after_data_was_updated_should_return_data(self): s_symbol = "SYMB11" data = {"a": 0, "b": 1, "c": 2} provider = CachedProvider(SymbolMap()) provider.update(s_symbol, data) result = provider.load(s_symbol) assert len(result) == 3
def test_load_after_data_was_updated_should_return_data(self): s_symbol = "SYMB11" data = { "a": 0, "b": 1, "c": 2 } provider = CachedProvider(SymbolMap()) provider.update(s_symbol, data) result = provider.load(s_symbol) assert len(result) == 3
def test_load_should_return_None_if_symbol_data_not_present(self): dataMapMock = mock(SymbolMap) dataMock = [] s_symbol = "" when(dataMapMock).get(s_symbol).thenReturn(dataMock) provider = CachedProvider(dataMapMock) result = provider.load(s_symbol) assert result is None verify(dataMapMock, times=1).get(anyv())
def test_update_should_update_dataMap(self): dataMapMock = mock(SymbolMap) dataMock = mock() newData = mock() s_symbol = "" when(dataMapMock).get(s_symbol).thenReturn(dataMock) provider = CachedProvider(dataMapMock) provider.update(s_symbol, newData) verify(dataMock, times=1).update(newData)
def test_should_subclass_abstractProvider(self): provider = CachedProvider(mock()) assert isinstance(provider, AbstractProvider)
def test_load_when_nothing_was_updated_should_return_None(self): s_symbol = "SYMB11" provider = CachedProvider(SymbolMap()) assert provider.load(s_symbol) is None