def test01_sitemapreport(self): # Login! sessID, headers, session_info = test_login( username=localsecrets.PADS_TEST_ID2, password=localsecrets.PADS_TEST_PW2) # get temp folder, cross platform tmpf = tempfile.gettempdir() # note api_key is required, but already in headers full_URL = base_plus_endpoint_encoded( f'/v2/Admin/Sitemap/?size=100&max_records=500&path={tmpf}') response = requests.get(full_URL, headers=headers) assert (response.ok == True) # these don't get affected by the level. r = response.json() site_map_index = r["siteMapIndex"] site_map_list = r["siteMapList"] assert (len(site_map_list) == 5)
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging logger = logging.getLogger() import requests import unittest import time from localsecrets import API_KEY_NAME, AUTH_KEY_NAME, API_KEY, PADS_TEST_ID, PADS_TEST_PW, PDF_ORIGINALS_PATH, PADS_TEST_ID2, PADS_TEST_PW2, use_server from unitTestConfig import base_api, base_plus_endpoint_encoded, headers, session_id, UNIT_TEST_CLIENT_ID, test_login # Login! sessID, headers, session_info = test_login(username=PADS_TEST_ID2, password=PADS_TEST_PW2) # set log level to error full_URL = base_plus_endpoint_encoded('/v2/Admin/LogLevel/?level=ERROR') response = requests.put(full_URL, headers=headers) class TestReports(unittest.TestCase): """ Note: tests are performed in alphabetical order, hence the function naming with forced order in the names. """ #TODO: Later these will need to be done while logged in. def test01_session_log_report_daterange(self): # note api_key is required, but already in headers from datetime import date, timedelta dt1 = date.today() - timedelta(4)
#!/usr/bin/env python # -*- coding: utf-8 -*- #2020.0610 # Upgraded tests to v2; set up tests against AOP which seems to be discontinued and thus constant import unittest import requests import opasDocPermissions from unitTestConfig import base_api, base_plus_endpoint_encoded, headers, session_id, UNIT_TEST_CLIENT_ID, test_login # Login! sessID, headers, session_info = test_login() class TestDatabaseSearchLoggedIn(unittest.TestCase): def test_search_long_para(self): # only Freud SE and GW have paratext search full_URL = base_plus_endpoint_encoded( '/v2/Database/Search/?paratext=ego id superego&abstract=True') response = requests.get(full_URL, headers=headers) assert (response.ok == True) r = response.json() #print (r) response_info = r["documentList"]["responseInfo"] response_set = r["documentList"]["responseSet"] assert (response_info["count"] == 6) print(response_set) def test_search_long_para_alt_seems_to_show_solr_misses_one(self): # This produces 0 results on the GVPi server; this result is correct though full_URL = base_plus_endpoint_encoded(
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging logger = logging.getLogger() import unittest import requests import localsecrets import tempfile from localsecrets import API_KEY_NAME, AUTH_KEY_NAME, API_KEY, PADS_TEST_ID, PADS_TEST_PW, PDF_ORIGINALS_PATH, PADS_TEST_ID2, PADS_TEST_PW2 from unitTestConfig import base_plus_endpoint_encoded, headers, test_login # Login! sessID, headers, session_info = test_login(username=localsecrets.PADS_TEST_ID2, password=localsecrets.PADS_TEST_PW2) class TestAdminSiteMap(unittest.TestCase): """ Note: tests are performed in alphabetical order, hence the function naming with forced order in the names. Note the endpoint returns a sitemap index <sitemap> <loc>https://pep-web-google.s3.amazonaws.com/X:\\AWS_S3\\AWSProd PEP-Web-Google/sitemap1.xml</loc> <lastmod>2021-05-18T09:07:17</lastmod> </sitemap> <sitemap> <loc>https://pep-web-google.s3.amazonaws.com/X:\\AWS_S3\\AWSProd PEP-Web-Google/sitemap2.xml</loc>
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import requests from unitTestConfig import base_plus_endpoint_encoded, headers import unitTestConfig # Login! sessID, headers, session_info = unitTestConfig.test_login() class TestConcurrency(unittest.TestCase): """ Note: tests are performed in alphabetical order, hence the function naming with forced order in the names. """ def test_contents_streams_reported_issue(self): """ https://stage-api.pep-web.rocks/v2/Metadata/Videos/?sourcecode=%2A&streams=false&limit=200&offset=0 """ count = 0 while count <= 20: full_URL = base_plus_endpoint_encoded( '/v2/Metadata/Journals/?limit=1000&offset=0') response = requests.get(full_URL, headers=headers) full_URL = base_plus_endpoint_encoded( '/v2/Metadata/Journals/?limit=1000&offset=0') response = requests.get(full_URL, headers=headers) full_URL = base_plus_endpoint_encoded( '/v2/Metadata/Videos/?limit=1000&offset=0&streams=false')