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
|
# File 'lib/zendesk2/help_center/create_help_center_section.rb', line 21
def mock
identity = cistern.serial_id
locale = params['locale'] ||= 'en-us'
position = data[:help_center_sections].values.select { |a| a['category_id'] == category_id }.size
record = {
'id' => identity,
'url' => url_for("/help_center/#{locale}/sections/#{identity}.json"),
'html_url' => html_url_for("/hc/#{locale}/sections/#{identity}.json"),
'author_id' => cistern.current_user['id'],
'comments_disabled' => false,
'label_names' => [],
'draft' => false,
'promoted' => false,
'position' => position,
'vote_sum' => 0,
'vote_count' => 0,
'category_id' => category_id,
'created_at' => timestamp,
'updated_at' => timestamp,
'name' => '',
'body' => '',
'source_locale' => locale,
'outdated' => false,
}.merge(section_params)
cistern.data[:help_center_sections][identity] = record
access_policy = {
'viewable_by' => 'everyone',
'managable_by' => 'staff',
'restricted_to_group_ids' => [],
'restricted_to_organization_ids' => [],
'required_tags' => [],
'section_id' => identity,
}
cistern.data[:help_center_access_policies][identity] = access_policy
mock_response('section' => record)
end
|