def test_v2_other_client_logout(self):
     headers = get_headers_not_logged_in()
     # now check who I am
     full_URL = base_plus_endpoint_encoded('/v2/Session/WhoAmI/')
     response = requests.get(full_URL, headers=headers)
     # Confirm that the request-response cycle completed successfully.
     r = response.json()
     #print (r)
     assert(r["username"] == opasConfig.USER_NOT_LOGGED_IN_NAME)
     #  this should logout of the database, but not send a message to PaDS
     full_URL = base_plus_endpoint_encoded('/v2/Session/Logout/')
     response = requests.get(full_URL, headers=headers)
     # Confirm that the request-response cycle completed successfully.
     assert(response.ok == True)
     r = response.json()
     assert(r["authenticated"] == False)
Пример #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import logging

logger = logging.getLogger(__name__)

import unittest
import requests

import opasCentralDBLib
import opasConfig

from unitTestConfig import base_plus_endpoint_encoded, headers, get_headers_not_logged_in
# Get session, but not logged in.
headers = get_headers_not_logged_in()

ocd = opasCentralDBLib.opasCentralDB()


class TestMostFromDb(unittest.TestCase):
    """
    Note: tests are performed in alphabetical order, hence the function naming
          with forced order in the names.
    
    """
    def test_001_download(self):
        import codecs
        import csv
        views = ocd.SQLSelectGenerator(
            "select * from vw_stat_most_viewed order by last12months DESC")