Revision 1371:a8d468e143f7 plugins/redmine_bibliography/test

View differences:

plugins/redmine_bibliography/test/fixtures/authors.yml
1
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
1
# authors.yml
2
---
2 3
one:
3 4
  id: 1
4 5
  user_id: 1
5
  name: Luis
6
  name:
6 7
two:
7 8
  id: 2
8 9
  user_id:
9
  name: Manel
10
  name:
10 11
three:
11 12
  id: 3
12 13
  user_id:
13
  name: MyString1
14
  name:
14 15
four:
15 16
  id: 4
16 17
  user_id:
17
  name: MyString2
18
  name:
plugins/redmine_bibliography/test/fixtures/authorships.yml
1
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
1
# authorships.yml
2
---
2 3
one:
3 4
  id: 1
4 5
  author_id: 1
5 6
  publication_id: 1
6 7
  name_on_paper: Yih-Farn R. Chen
7
  order: 1
8
  institution:
8
  auth_order: 1
9
  institution: Imperial College London
9 10
  email: MyString
10 11
two:
11 12
  id: 2
12 13
  author_id: 2
13 14
  publication_id: 1
14 15
  name_on_paper: Glenn S. Fowler
15
  order: 2
16
  auth_order: 2
16 17
  institution:
17 18
  email: MyString
18 19
three:
19 20
  id: 3
20
  author_id: 1
21
  author_id: 3
21 22
  publication_id: 1
22 23
  name_on_paper: Yih-Farn R. Chen
23
  order: 1
24
  auth_order: 1
24 25
  institution:
25 26
  email: MyString
26 27
four:
27 28
  id: 4
28
  author_id: 2
29
  author_id: 4
29 30
  publication_id: 1
30 31
  name_on_paper: Glenn S. Fowler
31
  order: 2
32
  auth_order: 2
32 33
  institution:
33 34
  email: MyString
plugins/redmine_bibliography/test/fixtures/publications.yml
1 1
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2 2
one:
3
  id: 1
4
  title: Test Fixture Title No1
5
  bibtex_entry_id: 1
3
    id: 1
4
    title: Publication Number 1
5
    reviewed: true
6
    external_url:
7
    doi:
6 8
two:
7
  id: 2
8
  title: MyString
9
  bibtex_entry_id: MyString
9
    id: 2
10
    title: Publication Number 2
11
    reviewed: false
12
    external_url:
13
    doi:
plugins/redmine_bibliography/test/fixtures/users.yml
1
--- 
2
users_004: 
1
# users.yml
2
---
3
users_004:
3 4
  created_on: 2006-07-19 19:34:07 +02:00
4 5
  status: 1
5
  last_login_on: 
6
  last_login_on:
6 7
  language: en
7 8
  # password = foo
8 9
  salt: 3126f764c3c5ac61cbfc103f25f934cf
......
13 14
  lastname: Hill
14 15
  firstname: Robert
15 16
  id: 4
16
  auth_source_id: 
17
  auth_source_id:
17 18
  mail_notification: all
18 19
  login: rhill
19 20
  type: User
20
users_001: 
21
users_001:
21 22
  created_on: 2006-07-19 19:12:21 +02:00
22 23
  status: 1
23 24
  last_login_on: 2006-07-19 22:57:52 +02:00
......
31 32
  lastname: Admin
32 33
  firstname: redMine
33 34
  id: 1
34
  auth_source_id: 
35
  auth_source_id:
35 36
  mail_notification: all
36 37
  login: admin
37 38
  type: User
38
users_002: 
39
users_002:
39 40
  created_on: 2006-07-19 19:32:09 +02:00
40 41
  status: 1
41 42
  last_login_on: 2006-07-19 22:42:15 +02:00
......
49 50
  lastname: Smith
50 51
  firstname: John
51 52
  id: 2
52
  auth_source_id: 
53
  auth_source_id:
53 54
  mail_notification: all
54 55
  login: jsmith
55 56
  type: User
56
users_003: 
57
users_003:
57 58
  created_on: 2006-07-19 19:33:19 +02:00
58 59
  status: 1
59
  last_login_on: 
60
  last_login_on:
60 61
  language: en
61 62
  # password = foo
62 63
  salt: 7599f9963ec07b5a3b55b354407120c0
......
67 68
  lastname: Lopper
68 69
  firstname: Dave
69 70
  id: 3
70
  auth_source_id: 
71
  auth_source_id:
71 72
  mail_notification: all
72 73
  login: dlopper
73 74
  type: User
74
users_005: 
75
users_005:
75 76
  id: 5
76 77
  created_on: 2006-07-19 19:33:19 +02:00
77 78
  # Locked
78 79
  status: 3
79
  last_login_on: 
80
  last_login_on:
80 81
  language: en
81 82
  hashed_password: 1
82 83
  updated_on: 2006-07-19 19:33:19 +02:00
......
84 85
  mail: dlopper2@somenet.foo
85 86
  lastname: Lopper2
86 87
  firstname: Dave2
87
  auth_source_id: 
88
  auth_source_id:
88 89
  mail_notification: all
89 90
  login: dlopper2
90 91
  type: User
91
users_006: 
92
users_006:
92 93
  id: 6
93 94
  created_on: 2006-07-19 19:33:19 +02:00
94 95
  status: 0
95
  last_login_on: 
96
  last_login_on:
96 97
  language: ''
97 98
  hashed_password: 1
98 99
  updated_on: 2006-07-19 19:33:19 +02:00
......
100 101
  mail: ''
101 102
  lastname: Anonymous
102 103
  firstname: ''
103
  auth_source_id: 
104
  auth_source_id:
104 105
  mail_notification: only_my_events
105 106
  login: ''
106 107
  type: AnonymousUser
107
users_007: 
108
users_007:
108 109
  id: 7
109 110
  created_on: 2006-07-19 19:33:19 +02:00
110 111
  status: 1
111
  last_login_on: 
112
  last_login_on:
112 113
  language: ''
113 114
  hashed_password: 1
114 115
  updated_on: 2006-07-19 19:33:19 +02:00
......
116 117
  mail: someone@foo.bar
117 118
  lastname: One
118 119
  firstname: Some
119
  auth_source_id: 
120
  auth_source_id:
120 121
  mail_notification: only_my_events
121 122
  login: someone
122 123
  type: User
123
users_008: 
124
users_008:
124 125
  id: 8
125 126
  created_on: 2006-07-19 19:33:19 +02:00
126 127
  status: 1
127
  last_login_on: 
128
  last_login_on:
128 129
  language: 'it'
129 130
  # password = foo
130 131
  salt: 7599f9963ec07b5a3b55b354407120c0
......
134 135
  mail: miscuser8@foo.bar
135 136
  lastname: Misc
136 137
  firstname: User
137
  auth_source_id: 
138
  auth_source_id:
138 139
  mail_notification: only_my_events
139 140
  login: miscuser8
140 141
  type: User
141
users_009: 
142
users_009:
142 143
  id: 9
143 144
  created_on: 2006-07-19 19:33:19 +02:00
144 145
  status: 1
145
  last_login_on: 
146
  last_login_on:
146 147
  language: 'it'
147 148
  hashed_password: 1
148 149
  updated_on: 2006-07-19 19:33:19 +02:00
......
150 151
  mail: miscuser9@foo.bar
151 152
  lastname: Misc
152 153
  firstname: User
153
  auth_source_id: 
154
  auth_source_id:
154 155
  mail_notification: only_my_events
155 156
  login: miscuser9
156 157
  type: User
157
groups_010: 
158
groups_010:
158 159
  id: 10
159 160
  lastname: A Team
160 161
  type: Group
161
groups_011: 
162
groups_011:
162 163
  id: 11
163 164
  lastname: B Team
164 165
  type: Group
165 166

  
166
  
167

  
plugins/redmine_bibliography/test/functional/authors_controller_test.rb
1
# authors_controller_test.rb
2

  
1 3
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2 4

  
3 5
class AuthorsControllerTest < ActionController::TestCase
4 6
  self.fixture_path = File.dirname(__FILE__) + "/../fixtures/"
5
  fixtures :users, :authors
7
  fixtures :users, :authors, :authorships
6 8

  
7
  def test_users_authors_relationship
8
    assert Author.first.user.name == "redMine Admin"
9
  def test_truth
10
    assert true
9 11
  end
10 12

  
11 13
end
plugins/redmine_bibliography/test/test_helper.rb
13 13

  
14 14
  end
15 15

  
16
  def test_publication
17
    pub = Publication.first
18

  
19
    assert 1 == 0
16
  def test_truth
17
    assert true
20 18
  end
21 19

  
22 20
  # def test_routing
plugins/redmine_bibliography/test/unit/author_test.rb
1
require File.dirname(__FILE__) + '/../test_helper'
1
# author_test.rb
2

  
3
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2 4

  
3 5
class AuthorTest < ActiveSupport::TestCase
4
  fixtures :authors
6
    self.fixture_path = File.dirname(__FILE__) + "/../fixtures/"
7
    fixtures :users, :authors, :authorships
5 8

  
6
  # Replace this with your real tests.
7
  def test_truth
8
    luis = Author.first
9
    def test_relationships
10
        author = Author.find(1)
11
        assert author.authorships.first.name_on_paper == "Yih-Farn R. Chen"
12
    end
9 13

  
10
    assert true
11
  end
12 14
end
plugins/redmine_bibliography/test/unit/publication_test.rb
1
require File.dirname(__FILE__) + '/../test_helper'
1
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2 2

  
3 3
class PublicationTest < ActiveSupport::TestCase
4
  fixtures :publications
4
    self.fixture_path = File.dirname(__FILE__) + "/../fixtures/"
5 5

  
6
  # Replace this with your real tests.
7
  def test_truth
8
    assert true
9
  end
6
    fixtures :publications, :authorships
7

  
8
    # Replace this with your real tests.
9
    def test_truth
10
        assert true
11
    end
12

  
13
    def test_relationships
14
        # test authorships - publication relationship
15
        publication = Publication.find(1)
16

  
17
        assert publication.authorships.count == 4
18
    end
19

  
10 20
end

Also available in: Unified diff