def test_get_table_is_memoized(self, Client): client = Mock() Client.return_value = client document = Document() mock_table = Mock() document._stored_table = mock_table table = document._table() eq_(table, mock_table) eq_(client.table.call_count, 0)
def test_get_table_is_memoized(self, Config): config = Mock() Config.return_value = config document = Document() mock_table = Mock() document._stored_table = mock_table table = document._table() eq_(table, mock_table) eq_(config.table.call_count, 0)
def test_get_table_creates_table_conection(self, Client): client = Mock() Client.return_value = client mock_table = Mock() client.table.return_value = mock_table document = Document() document._table_name = 'grouchy' table = document._table() eq_(document._stored_table, mock_table) eq_(table, mock_table) client.table.assert_called_with('grouchy')
def test_create(self, Config): config = Mock() Config.return_value = config with patch('catsnap.document.Document._table_name', 'root'): Document.create() config.create_table.assert_called_with('root')