Skip to content

Commit

Permalink
Federated cloudshares tests: new docker-compose nextcloud service to …
Browse files Browse the repository at this point in the history
…make cloudshare with, first test (not working yet)
  • Loading branch information
Danil committed Dec 22, 2018
1 parent 01d84be commit b1f1d2a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ services:
depends_on:
- db

app2:
image: nextcloud:apache
restart: always
networks:
backend:
aliases:
- app2
ports:
- 8081:80
volumes:
- nextcloud:/var/www/html
environment:
POSTGRES_DB: 'nextcloud2'
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'secret'
POSTGRES_HOST: 'db'

NEXTCLOUD_TRUSTED_DOMAINS: "app2"
NEXTCLOUD_ADMIN_USER: "admin"
NEXTCLOUD_ADMIN_PASSWORD: "admin"
depends_on:
- db

python-api:
build:
context: ../
Expand All @@ -43,6 +66,11 @@ services:
NEXTCLOUD_HOST: "app"
NEXTCLOUD_USERNAME: "admin"
NEXTCLOUD_PASSWORD: "admin"

NEXTCLOUD2_HOST: "app2"
NEXTCLOUD2_USERNAME: "admin"
NEXTCLOUD2_PASSWORD: "admin"

networks:
backend:
aliases:
Expand Down
25 changes: 25 additions & 0 deletions tests/test_federated_cloudshares.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from NextCloud import ShareType

from .base import BaseTestCase, NextCloud, NEXTCLOUD_URL


class TestFederatedCloudShares(BaseTestCase):

def setUp(self):
super(TestFederatedCloudShares, self).setUp()
user_password = self.get_random_string(length=8)
self.user_username = self.create_new_user('shares_user_', password=user_password)
self.nxc_local = self.nxc_local = NextCloud(NEXTCLOUD_URL, self.user_username, user_password, js=True)
# make user admin
self.nxc.add_to_group(self.user_username, 'admin')

def tearDown(self):
self.nxc.delete_user(self.user_username)

def test_create_federated_cloudhsare(self):
share_path = "Documents"

res = self.nxc_local.create_share(share_path,
share_type=ShareType.FEDERATED_CLOUD_SHARE.value,
share_with="admin@app:80")
assert res['ocs']['meta']['statuscode'] == self.SHARE_API_SUCCESS_CODE

0 comments on commit b1f1d2a

Please sign in to comment.