stormpath-sdk 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stormpath-sdk/auth/authentication_result.rb +15 -0
- data/lib/stormpath-sdk/auth/basic_authenticator.rb +17 -2
- data/lib/stormpath-sdk/auth/basic_login_attempt.rb +15 -0
- data/lib/stormpath-sdk/auth/username_password_request.rb +15 -0
- data/lib/stormpath-sdk/client/api_key.rb +15 -0
- data/lib/stormpath-sdk/client/client.rb +15 -0
- data/lib/stormpath-sdk/client/client_builder.rb +17 -2
- data/lib/stormpath-sdk/ds/data_store.rb +26 -1
- data/lib/stormpath-sdk/ds/resource_factory.rb +15 -0
- data/lib/stormpath-sdk/http/authc/sauthc1_signer.rb +15 -0
- data/lib/stormpath-sdk/http/http_client_request_executor.rb +15 -0
- data/lib/stormpath-sdk/http/request.rb +15 -0
- data/lib/stormpath-sdk/http/response.rb +15 -0
- data/lib/stormpath-sdk/resource/account.rb +15 -0
- data/lib/stormpath-sdk/resource/account_list.rb +15 -0
- data/lib/stormpath-sdk/resource/application.rb +115 -11
- data/lib/stormpath-sdk/resource/application_list.rb +15 -0
- data/lib/stormpath-sdk/resource/collection_resource.rb +15 -0
- data/lib/stormpath-sdk/resource/directory.rb +15 -0
- data/lib/stormpath-sdk/resource/directory_list.rb +15 -0
- data/lib/stormpath-sdk/resource/email_verification_token.rb +15 -0
- data/lib/stormpath-sdk/resource/error.rb +15 -0
- data/lib/stormpath-sdk/resource/group.rb +15 -0
- data/lib/stormpath-sdk/resource/group_list.rb +15 -0
- data/lib/stormpath-sdk/resource/group_membership.rb +16 -1
- data/lib/stormpath-sdk/resource/group_membership_list.rb +15 -0
- data/lib/stormpath-sdk/resource/instance_resource.rb +15 -0
- data/lib/stormpath-sdk/resource/password_reset_token.rb +15 -0
- data/lib/stormpath-sdk/resource/resource.rb +15 -0
- data/lib/stormpath-sdk/resource/resource_error.rb +15 -0
- data/lib/stormpath-sdk/resource/status.rb +15 -0
- data/lib/stormpath-sdk/resource/tenant.rb +15 -0
- data/lib/stormpath-sdk/resource/utils.rb +15 -0
- data/lib/stormpath-sdk/util/assert.rb +15 -0
- data/lib/stormpath-sdk/util/hash.rb +15 -0
- data/lib/stormpath-sdk/util/request_utils.rb +15 -0
- data/lib/stormpath-sdk/version.rb +17 -2
- data/test/client/write_spec.rb +59 -11
- metadata +121 -123
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -26,7 +41,7 @@ module Stormpath
|
|
26
41
|
def create account, group
|
27
42
|
|
28
43
|
#TODO: enable auto discovery
|
29
|
-
|
44
|
+
href = "/groupMemberships"
|
30
45
|
|
31
46
|
account_props = Hash.new
|
32
47
|
account_props.store HREF_PROP_NAME, account.get_href
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Resource
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Util
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
class Hash
|
2
17
|
|
3
18
|
# implementation borrowed from the vine project at
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
17
|
|
3
18
|
module Util
|
@@ -1,4 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2012 Stormpath, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Stormpath
|
2
|
-
VERSION = '0.
|
3
|
-
VERSION_DATE = '2012-
|
17
|
+
VERSION = '0.2.0'
|
18
|
+
VERSION_DATE = '2012-08-20'
|
4
19
|
end
|
data/test/client/write_spec.rb
CHANGED
@@ -15,8 +15,9 @@ describe "WRITE Operations" do
|
|
15
15
|
@update_group = false
|
16
16
|
@create_application = false
|
17
17
|
@verify_email = false
|
18
|
-
@
|
18
|
+
@send_password_reset_email = false
|
19
19
|
@verify_password_reset_token = false
|
20
|
+
@create_account_with_group_membership = false
|
20
21
|
@create_group_membership_from_account = false
|
21
22
|
@create_group_membership_from_group = false
|
22
23
|
@update_group_membership_with_deletion = false
|
@@ -27,9 +28,11 @@ describe "WRITE Operations" do
|
|
27
28
|
href = 'applications/fzyWJ5V_SDORGPk4fT2jhA'
|
28
29
|
application = @data_store.get_resource href, Application
|
29
30
|
|
30
|
-
result = application.
|
31
|
+
result = application.authenticate_account UsernamePasswordRequest.new 'tootertest', 'super_P4ss', nil
|
31
32
|
|
32
|
-
result.should be_kind_of
|
33
|
+
result.should be_kind_of AuthenticationResult
|
34
|
+
|
35
|
+
result.get_account.should be_kind_of Account
|
33
36
|
end
|
34
37
|
|
35
38
|
it "application should NOT be able to authenticate and catch the error" do
|
@@ -38,7 +41,7 @@ describe "WRITE Operations" do
|
|
38
41
|
|
39
42
|
href = 'applications/fzyWJ5V_SDORGPk4fT2jhA'
|
40
43
|
application = @data_store.get_resource href, Application
|
41
|
-
result = application.
|
44
|
+
result = application.authenticate_account UsernamePasswordRequest.new 'tootertest', 'WRONG_PASS', nil
|
42
45
|
|
43
46
|
rescue ResourceError => re
|
44
47
|
p '** Authentication Error **'
|
@@ -49,7 +52,7 @@ describe "WRITE Operations" do
|
|
49
52
|
p 'Error Code: ' + re.get_code.to_s
|
50
53
|
end
|
51
54
|
|
52
|
-
result.should_not be_kind_of
|
55
|
+
result.should_not be_kind_of AuthenticationResult
|
53
56
|
end
|
54
57
|
|
55
58
|
it "directory should be able to create account" do
|
@@ -181,16 +184,16 @@ describe "WRITE Operations" do
|
|
181
184
|
|
182
185
|
end
|
183
186
|
|
184
|
-
it "password reset
|
187
|
+
it "password reset email should be sent" do
|
185
188
|
|
186
|
-
if (@
|
189
|
+
if (@send_password_reset_email)
|
187
190
|
|
188
191
|
href = 'applications/fzyWJ5V_SDORGPk4fT2jhA'
|
189
192
|
application = @data_store.get_resource href, Application
|
190
193
|
|
191
|
-
|
194
|
+
result = application.send_password_reset_email 'rubysdk@email.com'
|
192
195
|
|
193
|
-
|
196
|
+
result.should be_kind_of Account
|
194
197
|
|
195
198
|
end
|
196
199
|
|
@@ -203,14 +206,59 @@ describe "WRITE Operations" do
|
|
203
206
|
href = 'applications/fzyWJ5V_SDORGPk4fT2jhA'
|
204
207
|
application = @data_store.get_resource href, Application
|
205
208
|
|
206
|
-
|
209
|
+
result = application.verify_password_reset_token 'N0Zt1W9jTW2hP37XAE1jTQ'
|
207
210
|
|
208
|
-
|
211
|
+
result.should be_kind_of Account
|
209
212
|
|
210
213
|
end
|
211
214
|
|
212
215
|
end
|
213
216
|
|
217
|
+
it "account should be created linked to a group" do
|
218
|
+
|
219
|
+
if (@create_account_with_group_membership)
|
220
|
+
|
221
|
+
directory_href = 'directories/wDTY5jppTLS2uZEAcqaL5A'
|
222
|
+
directory = @data_store.get_resource directory_href, Directory
|
223
|
+
|
224
|
+
group_href = 'groups/mCidbrAcSF-VpkNfOVvJkQ'
|
225
|
+
group = @data_store.get_resource group_href, Group
|
226
|
+
|
227
|
+
account = @data_store.instantiate Account, nil
|
228
|
+
account.set_email 'rubysdkwithgroup@email.com'
|
229
|
+
account.set_given_name 'Ruby'
|
230
|
+
account.set_password 'super_P4ss'
|
231
|
+
account.set_surname 'Sdk With Group'
|
232
|
+
account.set_username 'rubysdkwithgroup'
|
233
|
+
|
234
|
+
begin
|
235
|
+
|
236
|
+
directory.create_account account
|
237
|
+
account.add_group group
|
238
|
+
|
239
|
+
rescue ResourceError => re
|
240
|
+
|
241
|
+
false.should be true
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
group_added = false
|
246
|
+
account.get_groups.each { |tmpGroup|
|
247
|
+
|
248
|
+
if tmpGroup.get_href.include? group_href
|
249
|
+
|
250
|
+
group_added = true
|
251
|
+
break
|
252
|
+
end
|
253
|
+
}
|
254
|
+
|
255
|
+
group_added.should be true
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
|
214
262
|
it "account should be linked to specified group" do
|
215
263
|
|
216
264
|
if (@create_group_membership_from_account)
|