diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b10be69..baec67c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.6', '3.7', '3.8', '3.9' ] + python-version: [ '3.8', '3.9' ] steps: - name: Checkout uses: actions/checkout@v2.3.4 @@ -31,7 +31,7 @@ jobs: - name: Lint with black run: black --check . - name: Wait for rocket.chat server to be online - run: until curl --silent http://localhost:3000/api/info/; do sleep 15; echo "waiting for Rocket.Chat server to start"; done + run: until curl --silent http://localhost:3000/api/info/; do sleep 15; echo "waiting for Rocket.Chat server to start"; done; - name: Run tests run: pytest tests rocketchat_API -x --cov-report xml --cov=./ - name: Upload code coverage diff --git a/docker-compose-test-server.yml b/docker-compose-test-server.yml index 49ec1f3..c708420 100644 --- a/docker-compose-test-server.yml +++ b/docker-compose-test-server.yml @@ -22,8 +22,6 @@ services: mongo: image: mongo - ports: - - "27017:27017" restart: unless-stopped command: mongod --oplogSize 128 --replSet rs0 diff --git a/rocketchat_API/APISections/rooms.py b/rocketchat_API/APISections/rooms.py index 27218ca..8492f04 100644 --- a/rocketchat_API/APISections/rooms.py +++ b/rocketchat_API/APISections/rooms.py @@ -58,9 +58,17 @@ def rooms_admin_rooms(self, **kwargs): return self.call_api_get("rooms.adminRooms", kwargs=kwargs) def rooms_create_discussion(self, prid, t_name, **kwargs): - """Creates a new discussion for room. It requires at least one of the following permissions: - start-discussion OR start-discussion-other-user, AND must be with the following setting enabled: - Discussion_enabled.""" + """ + Creates a new discussion for room. It requires at least one of the + following permissions: start-discussion OR start-discussion-other-user, + AND must be with the following setting enabled: Discussion_enabled. + """ return self.call_api_post( "rooms.createDiscussion", prid=prid, t_name=t_name, kwargs=kwargs ) + + def rooms_export(self, rid, atype, aformat="html", **kwargs): + """Export room to a file or email.""" + return self.call_api_post( + "rooms.export", rid=rid, type=atype, format=aformat, kwargs=kwargs + ) diff --git a/tests/test_rooms.py b/tests/test_rooms.py index 22d378b..c311ddf 100644 --- a/tests/test_rooms.py +++ b/tests/test_rooms.py @@ -4,8 +4,6 @@ def test_rooms_upload(logged_rocket): - # ToDo: Find a better way to test that this endpoint actually works fine (when using json and not data fails - # silently) rooms_upload = logged_rocket.rooms_upload( "GENERAL", file="tests/assets/avatar.png", description="hey there" ).json() @@ -92,3 +90,8 @@ def test_rooms_admin_rooms(logged_rocket): rooms_with_filter = logged_rocket.rooms_admin_rooms(**{"filter": "general"}).json() assert rooms_with_filter.get("success") assert rooms_with_filter.get("rooms")[0].get("_id") == "GENERAL" + + +def test_rooms_export(logged_rocket): + rooms_export = logged_rocket.rooms_export(rid="GENERAL", atype="file").json() + assert rooms_export.get("success")