Skip to content

Commit

Permalink
fix: TimeEntryActiviries are now Project-related
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Krzyzak committed Nov 27, 2010
1 parent d2eda8b commit f4178bc
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 21 deletions.
11 changes: 11 additions & 0 deletions app/views/mylyn_connector/projects/_project.rxml
Expand Up @@ -19,5 +19,16 @@ xml.project(:id => project.id, :newIssueAllowed => new_issue_allowed?(project),
xml.issueCustomFieldsByTracker({:trackerId => tracker.id}, integer_list(cf_list)) unless cf_list.empty?
end
end

xml.timeEntryActivities do
project.activities.each do |activity|
xml.timeEntryActivity :id => activity.id do
xml.name activity.name
xml.position activity.position
xml.isDefault activity.is_default
end
end
end


end
100 changes: 100 additions & 0 deletions test/fixtures/1.0/enumerations.yml
@@ -0,0 +1,100 @@
---
enumerations_001:
name: Uncategorized
id: 1
type: DocumentCategory
active: true
enumerations_002:
name: User documentation
id: 2
type: DocumentCategory
active: true
enumerations_003:
name: Technical documentation
id: 3
type: DocumentCategory
active: true
enumerations_004:
name: Low
id: 4
type: IssuePriority
active: true
position: 1
enumerations_005:
name: Normal
id: 5
type: IssuePriority
is_default: true
active: true
position: 2
enumerations_006:
name: High
id: 6
type: IssuePriority
active: true
position: 3
enumerations_007:
name: Urgent
id: 7
type: IssuePriority
active: true
position: 4
enumerations_008:
name: Immediate
id: 8
type: IssuePriority
active: true
position: 5
enumerations_009:
name: Design
id: 9
type: TimeEntryActivity
position: 1
active: true
enumerations_010:
name: Development
id: 10
type: TimeEntryActivity
position: 2
is_default: true
active: true
enumerations_011:
name: QA
id: 11
type: TimeEntryActivity
position: 3
active: true
enumerations_012:
name: Default Enumeration
id: 12
type: Enumeration
is_default: true
active: true
enumerations_013:
name: Another Enumeration
id: 13
type: Enumeration
active: true
enumerations_014:
name: Inactive Activity
id: 14
type: TimeEntryActivity
position: 4
active: false
enumerations_015:
name: Development
id: 15
type: TimeEntryActivity
position: 5
is_default: false
active: true
project_id: 1
parent_id: 10
enumerations_016:
name: QA
id: 16
type: TimeEntryActivity
position: 3
active: false
project_id: 1
parent_id: 11
29 changes: 13 additions & 16 deletions test/functional/projects_controller_test.rb
Expand Up @@ -2,22 +2,7 @@

class MylynConnector::ProjectsControllerTest < MylynConnector::ControllerTest

class << self

# def fixtures(*table_names)
# dir = File.join(File.dirname(__FILE__), "../../test/fixtures/" + self.rr)
# Fixtures.create_fixtures(dir, "custom_fields")
#
# #TODO since 0.9 MemberRole exists
# table_names.push(:member_roles) if Object.const_defined?(:MemberRole)
#
# super(table_names)
# end

end

fixtures :users, :roles, :members, :member_roles, :issue_categories, :custom_fields, :trackers, :versions, :queries, :projects, :projects_trackers, :enabled_modules, :custom_fields_trackers

fixtures :users, :roles, :members, :member_roles, :issue_categories, :custom_fields, :trackers, :versions, :queries, :projects, :projects_trackers, :enabled_modules, :custom_fields_trackers, :enumerations


def setup
Expand Down Expand Up @@ -67,6 +52,18 @@ def test_all_unauthenticated
assert_tag :tag => 'issuecustomfieldsbytracker', :content => '6', :attributes => {:trackerid => 2}, :parent => {:tag => 'issuecustomfields', :children => {:count => 2}, :parent => p3}
assert_tag :tag => 'issuecustomfieldsbytracker', :content => '2 6', :attributes => {:trackerid => 3}, :parent => {:tag => 'issuecustomfields', :children => {:count => 2}, :parent => p3}

acts = {:tag => 'timeentryactivities', :children => {:count => 2}, :parent=>p1}
act = {:tag => 'timeentryactivity', :attributes => {:id => 15}, :parent => acts}
assert_tag :tag => 'name', :content => 'Development', :parent => act
assert_tag :tag => 'position', :content => '5', :parent => act
assert_tag :tag => 'isdefault', :content => 'false', :parent => act

acts = {:tag => 'timeentryactivities', :children => {:count => 3}, :parent=>p3}
act = {:tag => 'timeentryactivity', :attributes => {:id => 10}, :parent => acts}
assert_tag :tag => 'name', :content => 'Development', :parent => act
assert_tag :tag => 'position', :content => '2', :parent => act
assert_tag :tag => 'isdefault', :content => 'true', :parent => act

end

def test_all_authenticated
Expand Down
9 changes: 5 additions & 4 deletions test/schema/timeEntryActivities.xsd
Expand Up @@ -9,10 +9,11 @@

<xsd:element name="timeEntryActivities" xmlns="http://redmin-mylyncon.sf.net/api">
<xsd:complexType>
<xsd:sequence >
<xsd:element name="timeEntryActivity" type="tns:timeEntryActivity" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="api" type="tns:versionstring" use="required" />
<xsd:complexContent>
<xsd:extension base="tns:timeEntryActivities">
<xsd:attribute name="api" type="tns:versionstring" use="required" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>

Expand Down
4 changes: 3 additions & 1 deletion test/schema/types/project.xsd
Expand Up @@ -8,6 +8,7 @@
<xsd:include schemaLocation="property.xsd" />
<xsd:include schemaLocation="versionstring.xsd" />
<xsd:include schemaLocation="idList.xsd" />
<xsd:include schemaLocation="timeEntryActivity.xsd" />


<xsd:complexType name="project">
Expand Down Expand Up @@ -49,7 +50,8 @@
</xsd:complexType>
</xsd:element>


<xsd:element name="timeEntryActivities" type="tns:timeEntryActivities" />

</xsd:sequence>
<xsd:attribute name="newIssueAllowed" type="xsd:boolean" use="required"/>
<xsd:attribute name="moveIssueAllowed" type="xsd:boolean" use="required"/>
Expand Down
6 changes: 6 additions & 0 deletions test/schema/types/timeEntryActivity.xsd
Expand Up @@ -7,6 +7,12 @@

<xsd:include schemaLocation="property.xsd" />

<xsd:complexType name="timeEntryActivities">
<xsd:sequence >
<xsd:element name="timeEntryActivity" type="tns:timeEntryActivity" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="timeEntryActivity">
<xsd:complexContent>
<xsd:extension base="tns:sortedProperty">
Expand Down

0 comments on commit f4178bc

Please sign in to comment.