def given_invalid_page_size_parameter_then_throw_system_exit_error(
         default_parameters, capsys):
     args = [
         "-p",
         "non_numeric_value",
     ] + default_parameters
     with pytest.raises(SystemExit):
         parse_main_arguments(args)
         assert_error_message(capsys)
 def given_invalid_log_level_parameter_then_throw_system_exit_error(
         default_parameters, capsys):
     args = [
         "-l",
         "invalid_log_level",
     ] + default_parameters
     with pytest.raises(SystemExit):
         parse_main_arguments(args)
         assert_error_message(capsys)
        def result() -> MainArguments:
            # Arrange
            parameters = [
                "-s",
                FAKE_SECRET,
                "-k",
                FAKE_KEY,
                "-o",
                FAKE_OUTPUT_DIRECTORY,
                "-l",
                LOG_LEVEL,
                "-p",
                "30",
                "-i",
                FAKE_INPUT_DIRECTORY,
                "-d",
                TEST_SYNC_DATABASE_DIRECTORY,
                "-f",
                *TEST_FEATURES.split(
                ),  # Split to convert it into a list and use * to unpack the list into separated values
            ]

            # Act
            return parse_main_arguments(parameters)
        def result() -> MainArguments:
            # Arrange
            parameters = ["-s", FAKE_SECRET, "-k", FAKE_KEY]

            # Act
            return parse_main_arguments(parameters)
 def given_client_secret_parameter_is_missing_then_throw_error(capsys):
     args = ["-k", FAKE_KEY]
     with pytest.raises(SystemExit):
         parse_main_arguments(args)
         assert_error_message(capsys)
Beispiel #6
0
)
from tests.data_generation.sections import (
    generate_and_load_sections,
    rollback_loaded_sections,
)
from tests.data_generation.gradingperiods import get_gradingperiods
from tests.data_generation.courses import (
    generate_and_load_courses,
    rollback_loaded_courses,
)
from tests.data_generation.users import generate_and_load_users, rollback_loaded_users
from edfi_schoology_extractor.api.request_client import RequestClient
from edfi_schoology_extractor.helpers import arg_parser

load_dotenv()
arguments = arg_parser.parse_main_arguments(argv[1:])

logging.basicConfig(
    handlers=[
        logging.StreamHandler(stdout),
    ],
    format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
    level="INFO",
)
logger = logging.getLogger(__name__)

request_client: RequestClient = RequestClient(arguments.client_key,
                                              arguments.client_secret)

grading_periods = []
try:
Beispiel #7
0
def _load_configuration() -> arg_parser.MainArguments:
    load_dotenv()
    return arg_parser.parse_main_arguments(sys.argv[1:])