def test_adds_warning_message_with_missed_operator_to_postgres_log(self, fake_log): options = { 'path': 'file1.mpr', # These are not valid path and filesystem. But it does not matter here. 'filesystem': '/tmp'} columns = [] mpr_wrapper = MPRForeignDataWrapper(options, columns) fake_qual = AttrDict({'operator': 'foo'}) mpr_wrapper._matches([fake_qual], ['1']) self.assertEqual(fake_log.call_count, 1) fake_log.assert_called_with( 'Unknown operator foo in the AttrDict({\'operator\': \'foo\'}) qual. Row will be returned.', WARNING, hint='Implement foo operator in the MPR FDW wrapper.')
def test_adds_warning_message_with_missed_operator_to_postgres_log( self, fake_log): options = { 'path': 'file1.mpr', # These are not valid path and filesystem. But it does not matter here. 'filesystem': '/tmp' } columns = [] mpr_wrapper = MPRForeignDataWrapper(options, columns) fake_qual = AttrDict({'operator': 'foo'}) mpr_wrapper._matches([fake_qual], ['1']) self.assertEqual(fake_log.call_count, 1) fake_log.assert_called_with( 'Unknown operator foo in the AttrDict({\'operator\': \'foo\'}) qual. Row will be returned.', WARNING, hint='Implement foo operator in the MPR FDW wrapper.')
def test_returns_false_if_row_does_not_match_all_quals(self): options = { 'path': 'file1.mpr', # These are not valid path and filesystem. But it does not matter here. 'filesystem': '/tmp'} columns = ['column1'] mpr_wrapper = MPRForeignDataWrapper(options, columns) fake_qual = AttrDict({ 'operator': '=', 'field_name': 'column1', 'value': '1'}) self.assertFalse(mpr_wrapper._matches([fake_qual], ['2']))
def test_returns_false_if_row_does_not_match_all_quals(self): options = { 'path': 'file1.mpr', # These are not valid path and filesystem. But it does not matter here. 'filesystem': '/tmp' } columns = ['column1'] mpr_wrapper = MPRForeignDataWrapper(options, columns) fake_qual = AttrDict({ 'operator': '=', 'field_name': 'column1', 'value': '1' }) self.assertFalse(mpr_wrapper._matches([fake_qual], ['2']))