Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-04-24 13:04:29 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-08-10 00:45:12 +0300
commitb069b132267aee0f34da5bf16c828de66ec518ed (patch)
treefe5fa083a8d240308c6137c2c2fa0e7f17e93eb8 /build
parent0f6d98eed2e45623514ed7445aedf599a9d8d185 (diff)
convert pagination tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/LDAPContext.php15
-rw-r--r--build/integration/ldap_features/ldap-openldap.feature41
-rw-r--r--build/integration/ldap_features/openldap-uid-username.feature48
3 files changed, 83 insertions, 21 deletions
diff --git a/build/integration/features/bootstrap/LDAPContext.php b/build/integration/features/bootstrap/LDAPContext.php
index a4a878b1ca8..5b226753e5c 100644
--- a/build/integration/features/bootstrap/LDAPContext.php
+++ b/build/integration/features/bootstrap/LDAPContext.php
@@ -167,4 +167,19 @@ class LDAPContext implements Context {
}
PHPUnit_Framework_Assert::assertTrue(false, 'expected Exception not received');
}
+
+ /**
+ * @Given /^the "([^"]*)" result should contain "([^"]*)" of$/
+ */
+ public function theResultShouldContainOf($type, $expectedCount, TableNode $expectations) {
+ $listReturnedElements = simplexml_load_string($this->response->getBody())->data[0]->$type[0]->element;
+ $extractedIDsArray = json_decode(json_encode($listReturnedElements), 1);
+ $uidsFound = 0;
+ foreach($expectations->getRows() as $expectation) {
+ if(in_array($expectation[0], $extractedIDsArray)) {
+ $uidsFound++;
+ }
+ }
+ PHPUnit_Framework_Assert::assertSame((int)$expectedCount, $uidsFound);
+ }
}
diff --git a/build/integration/ldap_features/ldap-openldap.feature b/build/integration/ldap_features/ldap-openldap.feature
index 311334a7b49..299142cfedc 100644
--- a/build/integration/ldap_features/ldap-openldap.feature
+++ b/build/integration/ldap_features/ldap-openldap.feature
@@ -80,26 +80,25 @@ Feature: LDAP
| PurpleGroup | 1 |
| SquareGroup | 0 |
- Scenario: Test backup server
- Given modify LDAP configuration
- | ldapBackupHost | openldap |
- | ldapBackupPort | 389 |
- | ldapHost | foo.bar |
- | ldapPort | 2456 |
- And Logging in using web as "alice"
- Then the HTTP status code should be "200"
-
- Scenario: Test backup server offline
- Given modify LDAP configuration
- | ldapBackupHost | off.line |
- | ldapBackupPort | 3892 |
- | ldapHost | foo.bar |
- | ldapPort | 2456 |
- Then Expect ServerException on failed web login as "alice"
+ Scenario: Test backup server
+ Given modify LDAP configuration
+ | ldapBackupHost | openldap |
+ | ldapBackupPort | 389 |
+ | ldapHost | foo.bar |
+ | ldapPort | 2456 |
+ And Logging in using web as "alice"
+ Then the HTTP status code should be "200"
- Scenario: Test LDAP server offline, no backup server
- Given modify LDAP configuration
- | ldapHost | foo.bar |
- | ldapPort | 2456 |
- Then Expect ServerException on failed web login as "alice"
+ Scenario: Test backup server offline
+ Given modify LDAP configuration
+ | ldapBackupHost | off.line |
+ | ldapBackupPort | 3892 |
+ | ldapHost | foo.bar |
+ | ldapPort | 2456 |
+ Then Expect ServerException on failed web login as "alice"
+ Scenario: Test LDAP server offline, no backup server
+ Given modify LDAP configuration
+ | ldapHost | foo.bar |
+ | ldapPort | 2456 |
+ Then Expect ServerException on failed web login as "alice"
diff --git a/build/integration/ldap_features/openldap-uid-username.feature b/build/integration/ldap_features/openldap-uid-username.feature
index a8bb20abf8e..aa6010875c1 100644
--- a/build/integration/ldap_features/openldap-uid-username.feature
+++ b/build/integration/ldap_features/openldap-uid-username.feature
@@ -12,3 +12,51 @@ Feature: LDAP
And the "users" result should match
| alice | 1 |
| ghost | 0 |
+
+ Scenario: Fetch all users, invoking pagination
+ Given modify LDAP configuration
+ | ldapBaseUsers | ou=PagingTest,dc=nextcloud,dc=ci |
+ | ldapPagingSize | 2 |
+ And As an "admin"
+ And sending "GET" to "/cloud/users"
+ Then the OCS status code should be "200"
+ And the "users" result should match
+ | ebba | 1 |
+ | eindis | 1 |
+ | fjolnir | 1 |
+ | gunna | 1 |
+ | juliana | 1 |
+ | leo | 1 |
+ | stigur | 1 |
+
+ Scenario: Fetch all users, invoking pagination
+ Given modify LDAP configuration
+ | ldapBaseUsers | ou=PagingTest,dc=nextcloud,dc=ci |
+ | ldapPagingSize | 2 |
+ And As an "admin"
+ And sending "GET" to "/cloud/users?limit=10"
+ Then the OCS status code should be "200"
+ And the "users" result should match
+ | ebba | 1 |
+ | eindis | 1 |
+ | fjolnir | 1 |
+ | gunna | 1 |
+ | juliana | 1 |
+ | leo | 1 |
+ | stigur | 1 |
+
+ Scenario: Fetch first foall users, invoking pagination
+ Given modify LDAP configuration
+ | ldapBaseUsers | ou=PagingTest,dc=nextcloud,dc=ci |
+ | ldapPagingSize | 2 |
+ And As an "admin"
+ And sending "GET" to "/cloud/users?limit=10&offset=2"
+ Then the OCS status code should be "200"
+ And the "users" result should contain "5" of
+ | ebba |
+ | eindis |
+ | fjolnir |
+ | gunna |
+ | juliana |
+ | leo |
+ | stigur |