Exemple #1
0
 def test_updateInsert_update(self):
     dateInst = {'date_type': 'test', 'display_date': '0000'}
     with patch.object(DateField, 'lookupDate') as mock_lookup:
         mock_date = MagicMock()
         mock_lookup.return_value = mock_date
         testDate = DateField.updateOrInsert('session', dateInst, 'test', 1)
         mock_lookup.assert_called_once()
         self.assertEqual(testDate, mock_date)
Exemple #2
0
 def test_updateInsert_insert(self, mock_insert, mock_lookup):
     dateInst = {'date_type': 'test', 'display_date': '0000'}
     testDate = DateField.updateOrInsert('session', dateInst, 'test', 1)
     mock_lookup.assert_called_once()
     mock_insert.assert_called_once_with(dateInst)
     self.assertEqual(testDate, 'newDate')