diff options
Diffstat (limited to 'test/moodle.py')
-rw-r--r-- | test/moodle.py | 21 |
1 files changed, 16 insertions, 5 deletions
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) |