Skip to content

Commit 7f3d9be

Browse files
author
Danil
committed
Federated cloudshares tests: new docker-compose nextcloud service to make cloudshare with, first test (not working yet)
1 parent 01d84be commit 7f3d9be

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

tests/docker-compose.yml

+28
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,29 @@ services:
3535
depends_on:
3636
- db
3737

38+
app2:
39+
image: nextcloud:apache
40+
restart: always
41+
networks:
42+
backend:
43+
aliases:
44+
- app2
45+
ports:
46+
- 8081:80
47+
volumes:
48+
- nextcloud:/var/www/html
49+
environment:
50+
POSTGRES_DB: 'nextcloud2'
51+
POSTGRES_USER: 'postgres'
52+
POSTGRES_PASSWORD: 'secret'
53+
POSTGRES_HOST: 'db'
54+
55+
NEXTCLOUD_TRUSTED_DOMAINS: "app2"
56+
NEXTCLOUD_ADMIN_USER: "admin"
57+
NEXTCLOUD_ADMIN_PASSWORD: "admin"
58+
depends_on:
59+
- db
60+
3861
python-api:
3962
build:
4063
context: ../
@@ -43,6 +66,11 @@ services:
4366
NEXTCLOUD_HOST: "app"
4467
NEXTCLOUD_USERNAME: "admin"
4568
NEXTCLOUD_PASSWORD: "admin"
69+
70+
NEXTCLOUD2_HOST: "app2"
71+
NEXTCLOUD2_USERNAME: "admin"
72+
NEXTCLOUD2_PASSWORD: "admin"
73+
4674
networks:
4775
backend:
4876
aliases:

tests/test_federated_cloudshares.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from NextCloud import ShareType
2+
3+
from .base import BaseTestCase, NextCloud, NEXTCLOUD_URL
4+
5+
6+
class TestFederatedCloudShares(BaseTestCase):
7+
8+
def setUp(self):
9+
super(TestFederatedCloudShares, self).setUp()
10+
user_password = self.get_random_string(length=8)
11+
self.user_username = self.create_new_user('shares_user_', password=user_password)
12+
self.nxc_local = self.nxc_local = NextCloud(NEXTCLOUD_URL, self.user_username, user_password, js=True)
13+
# make user admin
14+
self.nxc.add_to_group(self.user_username, 'admin')
15+
16+
def tearDown(self):
17+
self.nxc.delete_user(self.user_username)
18+
19+
def test_create_federated_cloudhsare(self):
20+
share_path = "Documents"
21+
22+
res = self.nxc_local.create_share(share_path,
23+
share_type=ShareType.FEDERATED_CLOUD_SHARE.value,
24+
share_with="admin@app:80")
25+
assert res['ocs']['meta']['statuscode'] == self.SHARE_API_SUCCESS_CODE

0 commit comments

Comments
 (0)