Beispiel #1
0
    def test_submit(self):
        with patch('requests.post') as m:
            m.return_value = MagicMock()
            m.return_value.text = '{"id":1}'
            c = Client('test')

        with patch('requests.post') as mock:
            mock.return_value = MagicMock()
            mock.return_value.text = '{}'
            val = c.submit(MagicMock(), MagicMock())
            print(val)
            assert (val == {})
Beispiel #2
0
    def test_submit(self):
        with patch("requests.post") as m:
            m.return_value = MagicMock()
            m.return_value.text = '{"id":1}'
            c = Client("test")

        with patch("requests.post") as mock:
            mock.return_value = MagicMock()
            mock.return_value.text = "{}"
            val = c.submit(MagicMock(), MagicMock())
            print(val)
            assert val == {}