def test_show_gpm_no_gpm(self, mock_db, mock_decrypt, mock_raw_to_table, mock_print): mock_db().get_subordinate_details.return_value.fetchall.return_value = [] bdo = BDO() bdo.show_gpm() self.assertEqual(mock_print.call_count, 2) mock_db().get_subordinate_details.assert_called_once() mock_db().get_subordinate_details().fetchall.assert_called_once()
def test_show_gpm(self, mock_db, mock_decrypt, mock_raw_to_table, mock_print): mock_db().get_subordinate_details.return_value.fetchall.return_value = [['dummy1', 'dummy2', 'dummy3']] bdo = BDO() bdo.show_gpm() mock_print.assert_called_once_with("GPM's list:\n") mock_db().get_subordinate_details.assert_called_once() mock_db().get_subordinate_details().fetchall.assert_called_once() mock_decrypt.assert_called_once() mock_raw_to_table.assert_called_once()