unipept 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,92 @@
1
+ require_relative '../lib/server_message'
2
+
3
+ module Unipept
4
+ class ServerMessageTestCase < Unipept::TestCase
5
+ def test_init
6
+ assert_equal('http://test_host/api/v1/messages.json', ServerMessage.new('http://test_host').message_url)
7
+ end
8
+
9
+ def test_fetch_server_message
10
+ server = ServerMessage.new('http://api.unipept.ugent.be')
11
+ assert(!server.fetch_server_message.nil?)
12
+ end
13
+
14
+ def test_print_server_message
15
+ server = ServerMessage.new('http://api.unipept.ugent.be')
16
+ server.stub(:recently_fetched?, false) do
17
+ server.stub(:fetch_server_message, 'message') do
18
+ out, _err = capture_io_while do
19
+ def $stdout.tty?
20
+ true
21
+ end
22
+ server.print
23
+ end
24
+ assert_equal('message', out.chomp)
25
+ end
26
+ end
27
+ end
28
+
29
+ def test_empty_print_server_message
30
+ server = ServerMessage.new('http://api.unipept.ugent.be')
31
+ server.stub(:recently_fetched?, false) do
32
+ server.stub(:fetch_server_message, '') do
33
+ out, _err = capture_io_while do
34
+ def $stdout.tty?
35
+ true
36
+ end
37
+ server.print
38
+ end
39
+ assert_equal('', out)
40
+ end
41
+ end
42
+ end
43
+
44
+ def test_recent_print_server_message
45
+ server = ServerMessage.new('http://api.unipept.ugent.be')
46
+ server.stub(:recently_fetched?, true) do
47
+ server.stub(:fetch_server_message, 'message') do
48
+ out, _err = capture_io_while do
49
+ def $stdout.tty?
50
+ true
51
+ end
52
+ server.print
53
+ end
54
+ assert_equal('', out)
55
+ end
56
+ end
57
+ end
58
+
59
+ def test_no_tty_print_server_message
60
+ server = ServerMessage.new('http://api.unipept.ugent.be')
61
+ server.stub(:recently_fetched?, false) do
62
+ server.stub(:fetch_server_message, 'message') do
63
+ out, _err = capture_io_while do
64
+ def $stdout.tty?
65
+ false
66
+ end
67
+ server.print
68
+ end
69
+ assert_equal('', out)
70
+ end
71
+ end
72
+ end
73
+
74
+ def test_never_recently_fetched
75
+ server = ServerMessage.new('http://api.unipept.ugent.be')
76
+ server.configuration.delete('last_fetch_date')
77
+ assert(!server.recently_fetched?)
78
+ end
79
+
80
+ def test_old_recently_fetched
81
+ server = ServerMessage.new('http://api.unipept.ugent.be')
82
+ server.configuration['last_fetch_date'] = Time.now - 60 * 60 * 25
83
+ assert(!server.recently_fetched?)
84
+ end
85
+
86
+ def test_recently_recently_fetched
87
+ server = ServerMessage.new('http://api.unipept.ugent.be')
88
+ server.configuration['last_fetch_date'] = Time.now - 60 * 60 * 1
89
+ assert(server.recently_fetched?)
90
+ end
91
+ end
92
+ end
data/unipept.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: unipept 0.8.0 ruby lib
5
+ # stub: unipept 0.9.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "unipept"
9
- s.version = "0.8.0"
9
+ s.version = "0.9.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Toon Willems", "Bart Mesuere", "Tom Naessens"]
13
- s.date = "2015-06-12"
13
+ s.date = "2015-06-21"
14
14
  s.description = " Command line interface to the Unipept (http://unipept.ugent.be) web services\n (pept2lca, taxa2lca, pept2taxa and taxonomy) and some utility commands for\n handling proteins using the command line.\n"
15
15
  s.email = "unipept@ugent.be"
16
16
  s.executables = ["unipept", "prot2pept", "peptfilter", "uniprot"]
@@ -48,6 +48,8 @@ Gem::Specification.new do |s|
48
48
  "lib/commands/uniprot.rb",
49
49
  "lib/configuration.rb",
50
50
  "lib/formatters.rb",
51
+ "lib/output_writer.rb",
52
+ "lib/server_message.rb",
51
53
  "lib/version.rb",
52
54
  "test/commands/test_peptfilter.rb",
53
55
  "test/commands/test_prot2pept.rb",
@@ -62,10 +64,11 @@ Gem::Specification.new do |s|
62
64
  "test/commands/unipept/test_taxonomy.rb",
63
65
  "test/helper.rb",
64
66
  "test/test_bach_order.rb",
65
- "test/test_base.rb",
66
67
  "test/test_batch_iterator.rb",
67
68
  "test/test_configuration.rb",
68
69
  "test/test_formatters.rb",
70
+ "test/test_output_writer.rb",
71
+ "test/test_server_message.rb",
69
72
  "unipept.gemspec"
70
73
  ]
71
74
  s.homepage = "https://github.com/unipept/unipept-cli/"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unipept
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toon Willems
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-12 00:00:00.000000000 Z
13
+ date: 2015-06-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cri
@@ -154,6 +154,8 @@ files:
154
154
  - lib/commands/uniprot.rb
155
155
  - lib/configuration.rb
156
156
  - lib/formatters.rb
157
+ - lib/output_writer.rb
158
+ - lib/server_message.rb
157
159
  - lib/version.rb
158
160
  - test/commands/test_peptfilter.rb
159
161
  - test/commands/test_prot2pept.rb
@@ -168,10 +170,11 @@ files:
168
170
  - test/commands/unipept/test_taxonomy.rb
169
171
  - test/helper.rb
170
172
  - test/test_bach_order.rb
171
- - test/test_base.rb
172
173
  - test/test_batch_iterator.rb
173
174
  - test/test_configuration.rb
174
175
  - test/test_formatters.rb
176
+ - test/test_output_writer.rb
177
+ - test/test_server_message.rb
175
178
  - unipept.gemspec
176
179
  homepage: https://github.com/unipept/unipept-cli/
177
180
  licenses:
data/test/test_base.rb DELETED
@@ -1,6 +0,0 @@
1
- module Unipept
2
- class BaseTestCase < Unipept::TestCase
3
- def test_stub
4
- end
5
- end
6
- end