def testUpdateStatus(self): data = sample.copy() created_plan = self.service.create(Plan(**data)) self.assertTrue(created_plan.is_active) plan = self.service.update_status(created_plan.plan_id, False) self.assertFalse(plan.is_active)
def testGet(self): data = sample.copy() created_plan = self.service.create(Plan(**data)) plan = self.service.get(created_plan.plan_id) self.assertIsInstance(plan, Plan) self.assertEqual(created_plan, plan) self.assertEqual(created_plan.plan_id, plan.plan_id)
def testUpdate(self): data = sample.copy() created_plan = self.service.create(Plan(**data)) plan1 = self.service.update(created_plan.plan_id, "FooBar #1", created_plan.description) self.assertEqual("FooBar #1", plan1.name) plan2 = self.service.update(created_plan, "FooBar #2") self.assertEqual("FooBar #2", plan2.name) created_plan.name = "FooBar #3" plan3 = self.service.update(created_plan) self.assertEqual("FooBar #3", plan3.name)
def testCreate(self): data = sample.copy() plan = self.service.create(Plan(**data)) self.assertIsInstance(plan, Plan) self.assertIsNotNone(plan.plan_id)
def setUp(self) -> None: data = sample.copy() self.sample = data
import unittest from unittest.mock import patch from getnet.services.plans import Service, Plan from getnet.services.plans.plan_response import PlanResponse from getnet.services.service import ResponseList from tests.getnet.services.plans.test_plan import sample response_sample = sample.copy() response_sample.update( { "plan_id": "51995e24-b1ae-4826-8e15-2a568a87abdd", "create_date": "2017-04-19T16:30:30Z", "status": "active", } ) @patch("getnet.Client") class ServiceTest(unittest.TestCase): def setUp(self) -> None: data = sample.copy() self.sample = data def testCreate(self, client_mock): client_mock.post.return_value = response_sample service = Service(client_mock) plan = service.create(Plan(**sample)) self.assertIsInstance(plan, Plan)