Project

General

Profile

Feature #32002 ยป fixed-32002.patch

Yuichi HARADA, 2019-09-05 02:07

View differences:

app/views/projects/index.api.rsb
8 8
      api.parent(:id => project.parent.id, :name => project.parent.name) if project.parent && project.parent.visible?
9 9
      api.status      project.status
10 10
      api.is_public   project.is_public?
11
      api.inherit_members project.inherit_members?
11 12

  
12 13
      render_api_custom_values project.visible_custom_field_values, api
13 14
      render_api_includes(project, api)
app/views/projects/show.api.rsb
7 7
  api.parent(:id => @project.parent.id, :name => @project.parent.name) if @project.parent && @project.parent.visible?
8 8
  api.status      @project.status
9 9
  api.is_public   @project.is_public?
10
  api.inherit_members @project.inherit_members?
10 11

  
11 12
  render_api_custom_values @project.visible_custom_field_values, api
12 13
  render_api_includes(@project, api)
test/integration/api_test/projects_test.rb
30 30
  end
31 31

  
32 32
  test "GET /projects.xml should return projects" do
33
    project = Project.find(1)
34
    project.inherit_members = '1'
35
    project.save!
36

  
33 37
    get '/projects.xml'
34 38
    assert_response :success
35 39
    assert_equal 'application/xml', @response.content_type
36 40

  
37
    assert_select 'projects>project>id', :text => '1'
38
    assert_select 'projects>project>status', :text => '1'
39
    assert_select 'projects>project>is_public', :text => 'true'
41
    assert_select 'projects>project:first-child' do
42
      assert_select '>id', :text => '1'
43
      assert_select '>status', :text => '1'
44
      assert_select '>is_public', :text => 'true'
45
      assert_select '>inherit_members', :text => 'true'
46
    end
40 47
  end
41 48

  
42 49
  test "GET /projects.json should return projects" do
......
49 56
    assert_kind_of Array, json['projects']
50 57
    assert_kind_of Hash, json['projects'].first
51 58
    assert json['projects'].first.has_key?('id')
59
    assert json['projects'].first.has_key?('inherit_members')
52 60
  end
53 61

  
54 62
  test "GET /projects.xml with include=issue_categories should return categories" do
......
76 84
  end
77 85

  
78 86
  test "GET /projects/:id.xml should return the project" do
87
    project = Project.find(1)
88
    project.inherit_members = '1'
89
    project.save!
90

  
79 91
    get '/projects/1.xml'
80 92
    assert_response :success
81 93
    assert_equal 'application/xml', @response.content_type
......
83 95
    assert_select 'project>id', :text => '1'
84 96
    assert_select 'project>status', :text => '1'
85 97
    assert_select 'project>is_public', :text => 'true'
98
    assert_select 'project>inherit_members', :text => 'true'
86 99
    assert_select 'custom_field[name="Development status"]', :text => 'Stable'
87 100

  
88 101
    assert_select 'trackers', 0
......
96 109
    assert_kind_of Hash, json
97 110
    assert_kind_of Hash, json['project']
98 111
    assert_equal 1, json['project']['id']
112
    assert_equal false, json['project']['inherit_members']
99 113
  end
100 114

  
101 115
  test "GET /projects/:id.xml with hidden custom fields should not display hidden custom fields" do
    (1-1/1)