diff --git a/tests/fixtures/passwordfile.txt b/tests/fixtures/passwordfile.txt new file mode 100644 index 0000000..708dc2e --- /dev/null +++ b/tests/fixtures/passwordfile.txt @@ -0,0 +1 @@ +testosm:testpass diff --git a/tests/helper_tests.py b/tests/helper_tests.py index cfc528b..cb9286a 100644 --- a/tests/helper_tests.py +++ b/tests/helper_tests.py @@ -3,6 +3,14 @@ from . import osmapi_tests import osmapi import mock +import os + +__location__ = os.path.realpath( + os.path.join( + os.getcwd(), + os.path.dirname(__file__) + ) +) class TestOsmApiHelper(osmapi_tests.TestOsmApi): @@ -23,6 +31,16 @@ def setupMock(self, status=200): self.api._username = 'testuser' self.api._password = 'testpassword' + def test_passwordfile(self): + path = os.path.join( + __location__, + 'fixtures', + 'passwordfile.txt' + ) + my_api = osmapi.OsmApi(passwordfile=path) + self.assertEquals('testosm', my_api._username) + self.assertEquals('testpass', my_api._password) + def test_http_request_get(self): response = self.api._http_request( 'GET',