Esempio n. 1
0
Module keeps test suite for checking nfs client's `read and write` access
permission.

To change the class' attributes, defined through command line arguments
(for example, nfs server test file) directly in this module
(not with `config.py` or through those command line arguments), simply redefine
them in the class body
"""

import pytest

from config import *
import common
from .base_suite import AccessSuite

LOG = common.initiate_logger(RW_TEST_LOG)


class TestReadWrite(AccessSuite):
    """
    Test case for checking nfs client's `read and write` access permission
    for the mounted test folder from nfs server
    """
    @classmethod
    def setup_class(cls):
        """
        Run `base_suite.AccessSuite.setup_class` with this test case arguments
        """
        super().setup_class(LOG, RW_EXPORTS,
                            "NFS test - `read and write` access")
Esempio n. 2
0
To change the class' attributes, defined through command line arguments
(for example, nfs server test file) directly in this module
(not with `config.py` or through those command line arguments), simply redefine
them in the class body after their extraction by `extract_args`
"""

import logging
import pytest

from config import *
import common
from .base_suite import Suite, extract_args

DEBUG_LOG = logging.getLogger(DEBUG_LOG)
LOG = common.initiate_logger(OWN_TEST_LOG)


class TestOwner(Suite):
    """
    Test case for checking nfs client's user access permission for the mounted
    test folder from nfs server
    """

    # Getting arguments from command line
    client_pswd, test_file, test_user = extract_args(
        [LOC_PASS_OP, TEST_FILE_OP, TEST_USER_OP])

    @classmethod
    def user_action(cls, cmd, msg):
        """
Esempio n. 3
0
"""
Module keeps the basic test suite (actually two) for all of the made test cases
"""

import pytest

from config import *
from config import __file__ as config_file
from bridge import Bridge
import common
import set_up
import tear_down

DEBUG_LOG = common.initiate_logger(DEBUG_LOG)
CMD_LOG = common.initiate_logger(LOC_CMD_LOG)


def extract_args(options):
    """
    Gets `options` from command line of test execution, using `Pytest`
    special method
    """
    for opt in options:
        yield pytest.config.getoption(opt)


class Suite:
    """
    Represents general structure of every test suite in this package,
    thus serves as parent class for them.
    Contains common setup and teardown methods for class level, and same for
Esempio n. 4
0
Provides functional, using different python package - `Fabric`, in fact being
a wrapper for that package's functional.

Includes `Bridge` class, containing functions for:
    - sending files to remote host
    - executing commands on the remote host, using superuser priviligues
"""

import os.path
import logging
from fabric.api import env, output, put, sudo

from config import *
import common

CMD_LOG = common.initiate_logger(REM_CMD_LOG)
DEBUG_LOG = logging.getLogger(DEBUG_LOG)

# Fabric variables setup
env.password = SERVER_HOST_PASSWORD
env.host_string = '@'.join((SERVER_HOST_NAME, SERVER_ADDRESS))
env.warn_only = True
env.combine_stderr = False
output['everything'] = False


class Bridge:
    """
    Holds methods for interacting with remote host, using `Fabric` package
    functional. Official docs from http://www.fabfile.org/: