예제 #1
0
 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"
         })
예제 #2
0
 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"
                           })
예제 #3
0
파일: test_client.py 프로젝트: cgwire/gazu
 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"},
         )
예제 #4
0
파일: test_client.py 프로젝트: cgwire/gazu
 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"},
         )
예제 #5
0
파일: test_client.py 프로젝트: kiru42/gazu
 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"
             },
         )