safe.utilities.test.test_osm_downloader module

InaSAFE Disaster risk assessment tool developed by AusAid and World Bank - Import Dialog Test Cases.

Contact : ole.moller.nielsen@gmail.com

Note

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

class safe.utilities.test.test_osm_downloader.FakeQNetworkAccessManager[source]

Mock network manager for testing.

New in version 3.2.

get(request_url)[source]

Mock handler for a get request. :param request_url: Url being requested.

post(request_url, data=None)[source]

Mock handler for post requests. :param request_url: Requested url. :param data: Payload data (ignored).

request(request_url)[source]

Mock handler for an http request. :param request_url: Url being requested.

class safe.utilities.test.test_osm_downloader.MockQNetworkReply(parent=None)[source]

Bases: PyQt4.QtCore.QObject

A mock network reply for testing.

New in version 3.2.

Parameters:parent
attribute()[source]
downloadProgress
error()[source]
finished
isFinished()[source]

simulate download progress

read(size)[source]
readAll()[source]
readyRead
size()[source]
url()[source]
class safe.utilities.test.test_osm_downloader.OsmDownloaderTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test the OSM Downloader.

New in version 3.2.

setUp()[source]

Runs before each test.

test_extract_zip()[source]

Test extract_zip method. This function will only take care of one file for each extensions. If many files has the same extension, only the last one will be copied.

New in version 3.2.

test_fetch_zip()[source]

Test fetch zip method.

New in version 3.2.

test_load_shapefile()[source]

Test loading shape file to QGIS Main Window.

New in version 3.2.

safe.utilities.test.test_osm_downloader.read_all(path)[source]
Helper function to load all content of path in
safe/test/data/control/files folder.
Parameters:path (str) – File name to read in.
Returns:The file contents.
Return type:str