示例#1
0
 def test_pack_extra(self):
     model = mock.Mock()
     model_inst = model.return_value = mock.MagicMock()
     model_inst.__iter__.return_value = ['name', 'type']
     values = {'name': 'fakename', 'type': 'faketype', 'other': 'fakeother'}
     obj_ref = db_api.pack_extra(model, values)
     expected = [mock.call('name', 'fakename'),
                 mock.call('type', 'faketype'),
                 mock.call('extra', {'other': 'fakeother'})]
     self.assertTrue(model_inst.__iter__.called)
     self.assertEqual(model_inst.__setitem__.mock_calls, expected)
示例#2
0
 def test_pack_extra(self, mock):
     model = mock.MagicMock()
     values = {'name': 'fakename', 'type': 'faketype', 'other': 'fakeother'}
     db_api.pack_extra(model, values)
     self.assertTrue(mock.called)
 def test_pack_extra(self, mock):
     model = mock.MagicMock()
     values = {"name": "fakename", "type": "faketype", "other": "fakeother"}
     db_api.pack_extra(model, values)
     self.assertTrue(mock.called)