Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unsuccessful first steps to test new
api/auth.py
and `api/request.p…
…y` modules #177
- Loading branch information
1 parent
a5518a4
commit bacc6f9
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Standard library | ||
import unittest | ||
import json | ||
|
||
# Tested module | ||
from modules import ApiRequester | ||
|
||
class TestApiRequester(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.requester = ApiRequester() | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_setup_api_params(self): | ||
pass | ||
|
||
def test_api_auth_post_get_token(self): | ||
pass | ||
|
||
def test_api_auth_handle_token(self): | ||
pass | ||
|
||
def test_api_get_requests(self): | ||
pass | ||
|
||
def test_api_requests_handle_reply(self): | ||
pass | ||
|
||
def test_build_request_url(self): | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Standard library | ||
import unittest | ||
import json | ||
import os | ||
from pathlib import Path | ||
|
||
# PyQT | ||
from qgis.PyQt.QtCore import QSettings | ||
|
||
|
||
# Tested module | ||
from modules import Authenticator | ||
|
||
class TestAuthenticator(unittest.TestCase): | ||
|
||
def setUp(self): | ||
auth_folder = Path(__file__).parents[0] / "_auth" | ||
self.authenticator = Authenticator(auth_folder) | ||
self.authenticator.lang = "fr" | ||
self.qsettings = QSettings | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_instantiation(self): | ||
with self.assertRaises(TypeError): | ||
Authenticator(1) | ||
with self.assertRaises(ValueError): | ||
Authenticator() | ||
self.assertEqual(Authenticator("path").auth_folder, "path") | ||
|
||
def test_credentials_check_qsettings(self): | ||
self.qsettings.beginGroup("isogeo-plugin") | ||
self.qsettings.close() | ||
self.assertFalse(self.authenticator.credentials_check_qsettings()) | ||
|
||
def test_credentials_check_file(self): | ||
os.rename(Path(self.authenticator.auth_folder)/"client_secrets.json", Path(self.authenticator.auth_folder)/"client_secrets_test.json") | ||
self.assertFalse(self.authenticator.credentials_check_file()) | ||
os.rename(Path(self.authenticator.auth_folder)/"client_secrets_test.json", Path(self.authenticator.auth_folder)/"client_secrets.json") | ||
|
||
def test_credentials_update(self): | ||
pass | ||
|
||
def test_credentials_storer(self): | ||
pass | ||
|
||
def test_credentials_uploader(self): | ||
pass | ||
|
||
def test_manage_api_initialization(self): | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |