Ejemplo n.º 1
0
def test_request_call():
    with patch.object(requests, 'get') as mock_get:
        with patch.object(img, 'imread') as mock_img: # Ensure Map class does not try and create pixel map from mock
            sample_map = Greengraph(sample_start, sample_end, sample_delay)
            test_place = Map(*sample_map.geolocate(sample_start))
            print mock_get.mock_calls
            mock_get.assert_called_with('http://maps.googleapis.com/maps/api/staticmap?',params =  url)
Ejemplo n.º 2
0
def test_request_call():
    with patch.object(requests, 'get') as mock_get:
        with patch.object(
                img, 'imread'
        ) as mock_img:  # Ensure Map class does not try and create pixel map from mock
            sample_map = Greengraph(sample_start, sample_end, sample_delay)
            test_place = Map(*sample_map.geolocate(sample_start))
            print mock_get.mock_calls
            mock_get.assert_called_with(
                'http://maps.googleapis.com/maps/api/staticmap?', params=url)
Ejemplo n.º 3
0
def test_geolocate():
    with patch.object(geocoders, 'GoogleV3') as mock_get:
        mymap = Greengraph(sample_start, sample_end, sample_delay)
        mymap.geolocate(sample_start)
        print mock_get.mock_calls
        mock_get.assert_called_with(domain='maps.google.co.uk')
Ejemplo n.º 4
0
def test_geolocate():
    with patch.object(geocoders, 'GoogleV3') as mock_get:
        mymap = Greengraph(sample_start, sample_end, sample_delay)
        mymap.geolocate(sample_start)
        print mock_get.mock_calls
        mock_get.assert_called_with(domain='maps.google.co.uk')