This repository was archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtest_workspaces.rb
More file actions
62 lines (52 loc) · 2.46 KB
/
test_workspaces.rb
File metadata and controls
62 lines (52 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
class WorkspacesTest < TestBase
def test_all_requests
workspace = Workspace.new
create_workspace = CreateWorkspaceRequest.new(workspace)
assert_equal create_workspace.success?, true
assert_equal workspace.same?(create_workspace.workspace), true
workspace = create_workspace.workspace
retrieve_workspace = RetrieveWorkspaceRequest.new(workspace)
assert_equal retrieve_workspace.success?, true
assert_equal workspace.same?(retrieve_workspace.workspace), true
workspace = retrieve_workspace.workspace
retrieve_all_workspaces = RetrieveAllWorkspacesRequest.new
assert_equal retrieve_all_workspaces.success?, true
retrieve_default_workspace = RetrieveDefaultWorkspaceRequest.new
assert_equal retrieve_default_workspace.success?, true
form = CreateFormRequest.execute(Form.new).form
operations = [
PatchOperation.new(op: 'replace', path: '/name', value: DataGenerator.title),
PatchOperation.new(op: 'add', path: '/members', value: { email: email })
]
update_workspace = UpdateWorkspaceRequest.new(workspace, operations)
assert_equal update_workspace.success?, true
UpdateWorkspaceRequest.execute(workspace, [PatchOperation.new(op: 'remove', path: '/members', value: { email: email })])
DeleteFormRequest.execute(form)
delete_workspace = DeleteWorkspaceRequest.new(workspace)
assert_equal delete_workspace.success?, true
end
def test_same_method
workspace = Workspace.new
same_workspace = workspace.dup
assert_equal workspace.same?(same_workspace), true
different_workspace = workspace.dup
different_workspace.name = DataGenerator.title
assert_equal workspace.same?(different_workspace), false
end
end