def case_delete_records(self, refresh_db_before): """ Create new record in Admin table and then delete it.""" new_name = "admin1" AdminOp.add(new_name) adm_obj = AdminOp.get(name=new_name) self.assertTrue(len(adm_obj) is 1) self.assertEqual(adm_obj[0].name, new_name) AdminOp.delete(adm_obj[0]) adm_obj = AdminOp.get(name=new_name) self.assertFalse(adm_obj)
def test_delete(self, mock_admin, mock_db): """ Assumptions: - delete method run """ admin_obj = mock_admin() AdminOp.delete(admin_obj) db_exp_calls = [ mock.call.session.delete(admin_obj), mock.call.session.commit() ] mock_db.assert_has_calls(db_exp_calls)