def test_post(self): with requests_mock.mock() as mock: mock.post(client.get_full_url('data/persons'), text='{"id": "person-1", "first_name": "John"}') self.assertEquals(client.post('data/persons', "person-1"), { "id": "person-1", "first_name": "John" })
def test_post_with_a_date_field(self): now = datetime.datetime.now() with requests_mock.mock() as mock: mock.post(client.get_full_url('data/persons'), text='{"id": "person-1", "first_name": "John"}') self.assertEquals(client.post("data/persons", {"birth_date": now}), { "id": "person-1", "first_name": "John" })
def test_post(self): with requests_mock.mock() as mock: mock.post( raw.get_full_url("data/persons"), text=json.dumps({"id": "person-01", "first_name": "John"}), ) self.assertEqual( raw.post("data/persons", "person-01"), {"id": "person-01", "first_name": "John"}, )
def test_post_with_a_date_field(self): now = datetime.datetime.now() with requests_mock.mock() as mock: mock.post( raw.get_full_url("data/persons"), text=json.dumps({"id": "person-01", "first_name": "John"}), ) self.assertEqual( raw.post("data/persons", {"birth_date": now}), {"id": "person-01", "first_name": "John"}, )
def test_post(self): with requests_mock.mock() as mock: mock.post( client.get_full_url("data/persons"), text='{"id": "person-01", "first_name": "John"}', ) self.assertEqual( client.post("data/persons", "person-01"), { "id": "person-01", "first_name": "John" }, )