From a9007a546964009dc2979a96b75d02291e4130b5 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Fri, 12 Feb 2021 01:31:01 +0100 Subject: Continue refractor of muddle.moodle --- test/moodle.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'test/moodle.py') diff --git a/test/moodle.py b/test/moodle.py index 3669ef8..d795eba 100644 --- a/test/moodle.py +++ b/test/moodle.py @@ -16,10 +16,21 @@ config.read(config_file) class TestMoodleInstance: - server = moodle.MoodleInstance(config["server"]["url"], config["server"]["token"]) + server = moodle.MoodleInstance(config["server"]["url"], config["server"]["token"]) - def test_get_userid(self): - assert self.server.get_userid() != None + def test_get_userid(self): + assert self.server.get_userid() != None - def test_get_enrolled_courses(self): - assert type(next(self.server.get_enrolled_courses())) == moodle.Course + def test_get_enrolled_courses(self): + assert type(next(self.server.get_enrolled_courses())) == moodle.Course + + +def test_moodle_api(): + server = moodle.MoodleInstance(config["server"]["url"], config["server"]["token"]) + + for course in server.get_enrolled_courses(): + print(course.shortname) + for section in course.get_sections(server.api): + print(section.name) + for module in section.get_modules(): + print(module.name) -- cgit v1.2.1