univention.testing.ucsschool package

Submodules

univention.testing.ucsschool.acl module

univention.testing.ucsschool.computerroom module

univention.testing.ucsschool.conftest module

univention.testing.ucsschool.distribution module

Class Distribution

class univention.testing.ucsschool.distribution.Distribution(school, connection=None, sender=None, flavor=None, ucr=None, description=None, name=None, distributeType='manual', distributeTime=None, distributeDate=None, collectType='manual', collectTime=None, collectDate=None, files=[], recipients=[])[source]

Bases: object

Contains the needed functionality for Materials distribution. By default the distribution is manual.

Parameters
  • school (str) – name of the ou

  • connection (UMC connection object) –

  • ucr (UCR object) –

  • name (str) – name of distribution project to be added later

  • description (str) – description of distribution project to be added later

  • sender (str) – name of the creater user (teacher or admin)

  • flavor (str ('teacher' or 'admin')) – flavor of the acting user

  • distributeTime (str ('%I:%M')) – time for automatic distribution

  • distributionDate (str ('%Y-%m-%d)) – date for automatic distribution

  • collectionTime (str ('%I:%M')) – time for automatic collection

  • collectionDate (str ('%Y-%m-%d)) – date for automatic collection

  • distributeType – type of the distribution

  • collectionTye – type of the collection

  • files (list of str) – names of material files for the distribution project

  • recipients (list of group objects) – groups which are included in the distribution project

property files
property files_encoded
query(filt='private', pattern='')[source]

Calles ‘distribution/query’ :param pattern: the pattern to use in the search :type pattern: str

get()[source]

Calls ‘distribute/get’

idir(path)[source]

Dir a specific path.

Parameters

path (str) – wanted path

Returns

list of file names

genData(file_name, content_type, boundary, flavor, override_file_name=None)[source]

Generates data in the form to be sent via http POST request.

Parameters
  • file_name (str) – file name to be uploaded

  • content_type (str ('text/plain',..)) – type of the content of the file

  • boundary (str (-------123091)) – the boundary

  • flavor (str) – flavor of the acting user

uploadFile(file_name, content_type=None, override_file_name=None)[source]

Uploads a file via http POST request.

Parameters
  • file_name (str) – file name to be uploaded

  • content_type (str ('text/plain',..)) – type of the content of the file

add()[source]

Create files and upload them then add the project, calls: ‘distribution/add’

check_add()[source]

Calls ‘distribution/query’ and check the existance of the added project

put(description=None, distributeType=None, distributeTime=None, distributeDate=None, collectType=None, collectTime=None, collectDate=None, files=[], recipients=[])[source]

Modifies the already existing project.

Parameters
  • description (str) – description of the project to be added later

  • distributeTime (str ('%I:%M')) – time for automatic distribution

  • distributionDate (str ('%Y-%m-%d)) – date for automatic distribution

  • collectionTime (str ('%I:%M')) – time for automatic collection

  • collectionDate (str ('%Y-%m-%d)) – date for automatic collection

  • distributeType – type of the distribution

  • collectionTye – type of the collection

  • files (list of str) – names of material files for the distribution project

  • recipients (list of group objects) – groups which are included in the project

check_put(previousGetResult)[source]

Calls ‘distribution/get’ and check the modified project :param previousGetResult: info from previous get :type previousGetResult: dict check changing sates for distribution and collection

put_fail(before_type, after_type, before_time, after_time, before_atJob, after_atJob)[source]

Checks if the atjobs are in the expected formats :param before_type: type before using put command :type before_type: str :param after_type: type after using put command :type after_type: str :param before_atJob: atJobNum before using put command :type before_atJob: str or None :param after_atJob: atJobNum after using put command :type after_atJob: str or None :param before_time: time before using put command :type before_time: str :param after_time: time after using put command :type after_time: str

distribute()[source]

Calls ‘distribution/distribute’

check_distribute(users)[source]

Checks if the distribution was successful by checking the file system.

Parameters

users (list of str) – names of users to have the material distributed for

collect()[source]

Calls ‘distribution/collect’

check_collect(users)[source]

Checks if the collection was successful by checking the file system.

Parameters

users (list of str) – names of users to have the material collected from

remove()[source]

Calls ‘distribution/remove’

check_remove()[source]

Calls ‘distribution/query’ and check the existance of the removed project

checkFiles(files)[source]

Calls ‘distribution/checkfiles’

adopt(project_name)[source]

Calls ‘distribute/adopt’

check_adopt(project_name)[source]
getUserFilesPath(user, purpose='distribute', version=1)[source]

Gets the correct files path for a specific user depending on the value of the ucr variable ucsschool/import/roleshare.

Parameters
  • user (str) – user name

  • purpose (str ('distribute' or 'collect')) – either for distribution or collection

univention.testing.ucsschool.exam module

Class Exam

univention.testing.ucsschool.exam.get_dir_files(dir_path, recursive=True)[source]
univention.testing.ucsschool.exam.get_s4_rejected()[source]
univention.testing.ucsschool.exam.check_s4_rejected(existing_rejects)[source]
univention.testing.ucsschool.exam.check_proof_uniqueMember()[source]
univention.testing.ucsschool.exam.wait_replications_check_rejected_uniqueMember(existing_rejects)[source]
class univention.testing.ucsschool.exam.Exam(school, room, examEndTime, recipients, name=None, directory=None, files=[], shareMode='home', internetRule='none', customRule='', connection=None)[source]

Bases: object

Contains the needed functionality for exam module.

Parameters
  • school (str) – name of the school

  • room (str) – name of room of the exam

  • examEndTime (str in format "HH:mm") – exam end time

  • name (str) – name of the exam to be created later

  • recipients (list of str) – names of the classes to make the exam

  • directory (str) – name of the directory for the exam, default=name

  • files (list of str) – list of files to be uploaded to the exam directory

  • sharemode (str either "home" or "all") – sharemode

  • internetRule (str) – name of the internet Rule to be applied in the exam

  • customRule (str) – cutom internet rule

  • connection (UMC connection object) –

start()[source]

Starts an exam

save(update=False, fields=None)[source]

Saves an exam. If fields is a list only the given values are set in the request

get()[source]

Gets an exam and returns result

delete()[source]

Deletes an exam and returns result

finish()[source]

Finish an exam

genData(file_name, content_type, boundary, override_file_name=None)[source]

Generates data in the form to be sent via http POST request.

Parameters
  • file_name (str) – file name to be uploaded

  • content_type (str ('text/plain',..)) – type of the content of the file

  • boundary (str (-------123091)) – the boundary

  • flavor (str) – flavor of the acting user

uploadFile(file_name, content_type=None, override_file_name=None)[source]

Uploads a file via http POST request.

Parameters
  • file_name (str) – file name to be uploaded

  • content_type (str ('application/octet-stream',..)) – type of the content of the file

get_internetRules()[source]

Get internet rules

fetch_internetRule(internetRule_name)[source]
get_schools()[source]

Get schools

fetch_school(school)[source]
get_groups()[source]

Get groups

fetch_groups(group)[source]
get_lessonEnd()[source]

Get lessonEnd

fetch_lessonEnd(lessonEnd)[source]
collect()[source]

Collect results

check_collect()[source]
check_upload()[source]
check_distribute()[source]
class univention.testing.ucsschool.exam.ExamSaml(*args, **kwargs)[source]

Bases: univention.testing.ucsschool.exam.Exam

univention.testing.ucsschool.import_factory_test_classes module

univention.testing.ucsschool.importcomputers module

univention.testing.ucsschool.importgroups module

univention.testing.ucsschool.importnetworks module

univention.testing.ucsschool.importou module

univention.testing.ucsschool.importprinters module

univention.testing.ucsschool.importusers module

univention.testing.ucsschool.importusers_cli_v2 module

univention.testing.ucsschool.importusers_http module

univention.testing.ucsschool.internetrule module

univention.testing.ucsschool.kelvin_api module

univention.testing.ucsschool.klasse module

univention.testing.ucsschool.radius module

univention.testing.ucsschool.randomdomain module

class univention.testing.ucsschool.randomdomain.RandomDomain[source]

Bases: object

Generates random internet domain names

getDomainList(count)[source]

Generate list of domains names

Parameters

count (int) – number of wanted domains

Returns

[str] domains list

univention.testing.ucsschool.school module

univention.testing.ucsschool.schoolroom module

univention.testing.ucsschool.simplecurl module

class univention.testing.ucsschool.simplecurl.SimpleCurl(proxy, username=None, password=None, bFollowLocation=1, maxReDirs=5, connectTimout=10, timeOut=10, port=3128, auth=pycurl.HTTPAUTH_BASIC, cookie=None)[source]

Bases: object

pycurl simple class implementation

Parameters
  • proxy (str) – proxy for the http requests

  • username (str) – to use for http requests

  • password (str) – password for the user provided

  • bFollowLocation (bool) –

  • maxReDirs (int) –

  • connectTimeout (int) –

  • port (int) –

  • auth (int) – authentication type

cookies()[source]
getPage(url, bVerbose=False, postData=None, encoding='UTF-8')[source]

Gets a http page this method keep trying to fetch the page for 60secs then stops raising and exception if not succeeded.

Parameters
  • url (str) – url

  • bVerbose (bool) – if verbose

  • postData

Returns

html page

httpCode()[source]

HTTP status code

Returns

int - http_status_code

response(url)[source]

HTTP status code

Parameters

url (str) – url

Returns

int - HTTP status code

close()[source]

Close the curl connection

univention.testing.ucsschool.test_samba4 module

class univention.testing.ucsschool.test_samba4.TestSamba4[source]

Bases: object

Test class constructor

return_code_result_skip()[source]

Stops the test returning the code 77 (RESULT_SKIP).

remove_samba_warnings(input_str)[source]

Removes the Samba Warning/Note from the given input_str.

create_and_run_process(cmd, stdin=None, std_input=None, shell=False, stdout=- 1)[source]

Creates a process as a Popen instance with a given ‘cmd’ and executes it. When stdin is needed, it can be provided with kwargs. To write to a file an istance can be provided to stdout.

start_stop_service(service, action)[source]

Starts, stops or restarts the given ‘service’ depending on the given ‘action’ is ‘start’, ‘stop’, ‘restart’ respectively.

dc_master_has_samba4()[source]

Returns ‘True’ when Primary Directory Node has Samba4 according to “service=Samba 4”

is_a_school_branch_site(host_dn)[source]

Returns True if the given ‘host_dn’ is located in the School branch site.

grep_for_key(grep_in, key)[source]

Runs grep on given ‘grep_in’ with a given ‘key’. Returns the output.

sed_for_key(input, key)[source]

Runs sed on given ‘input’ with a given ‘key’. Returns the output.

get_udm_list_dcs(dc_type, with_samba4=True, with_ucsschool=False)[source]

Runs the “udm computers/’dc_type’ list” and returns the output. If ‘with_samba4’ is ‘True’ returns only those running Samba 4.

get_udm_list_dc_slaves_with_samba4(with_ucsschool=False)[source]

Returns the output of “udm computers/domaincontroller_slave list –filter service=Samba 4” command.

select_school_ou(schoolname_only=False)[source]

Returns the first found School OU from the list of Replica Directory Nodes in domain.

get_samba_sam_ldb_path()[source]

Returns the ‘sam.ldb’ path using samba conf or defaults.

get_ucr_test_credentials()[source]

Loads the UCR to get credentials for the test.

create_umc_connection_authenticate()[source]

Creates UMC connection and authenticates to Primary Directory Node with the test user credentials.

delete_samba_gpo()[source]

Deletes the Group Policy Object using the ‘samba-tool gpo del’.

univention.testing.ucsschool.ucs_test_school module

univention.testing.ucsschool.user module

univention.testing.ucsschool.workgroup module