diff options
author | Nao Pross <np@0hm.ch> | 2021-02-12 01:31:01 +0100 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2021-02-12 01:31:01 +0100 |
commit | a9007a546964009dc2979a96b75d02291e4130b5 (patch) | |
tree | 89fb47beb98ed998364ad62244dc150091614ebd /test/moodle.py | |
parent | Partially refractor muddle.moodle and add test (diff) | |
download | Muddle-a9007a546964009dc2979a96b75d02291e4130b5.tar.gz Muddle-a9007a546964009dc2979a96b75d02291e4130b5.zip |
Continue refractor of muddle.moodle
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) |