mock.call.headers.update

Here are the examples of the python api mock.call.headers.update taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: pushjack Source File: test_gcm.py
@parametrize('tokens,data,extra,auth,expected', [
    ('abc',
     {},
     {},
     mock.call().headers.update({'Authorization': 'key=1234',
                                 'Content-Type': 'application/json'}),
     mock.call().post('https://android.googleapis.com/gcm/send',
                      b'{"data":{},"priority":"high","to":"abc"}')),
    (['abc'],
     {},
     {},
     mock.call().headers.update({'Authorization': 'key=1234',
                                 'Content-Type': 'application/json'}),
     mock.call().post('https://android.googleapis.com/gcm/send',
                      b'{"data":{},"priority":"high","to":"abc"}'))
])
def test_gcm_connection_call(gcm_client, tokens, data, extra, auth, expected):
    with mock.patch('requests.Session') as Session:
        gcm_client.send(tokens, data, **extra)
        assert auth in Session.mock_calls
        assert expected in Session.mock_calls