Skip to content

Commit

Permalink
Adds unit test: initialize Client with cache.
Browse files Browse the repository at this point in the history
Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>
  • Loading branch information
mkouhei committed Sep 10, 2015
1 parent 4d6e172 commit 32b8af2
Show file tree
Hide file tree
Showing 3 changed files with 250 additions and 1 deletion.
1 change: 1 addition & 0 deletions mtodos.gemspec
Expand Up @@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec"
spec.add_development_dependency "webmock"
spec.add_development_dependency "simplecov"
spec.add_dependency "memcached"
end
11 changes: 10 additions & 1 deletion spec/mtodos_spec.rb
@@ -1,14 +1,23 @@
require 'spec_helper'
require 'webmock'
require 'mtodos'

include WebMock::API


describe Mtodos do
data = File.read('spec/udd.debian.org.json')
stub_request(:any, 'udd.debian.org').to_return(
:body => data,
:status => 200,
:headers => {'Content-Length' => 7632}
)
it 'has a version number' do
expect(Mtodos::VERSION).not_to be nil
end

it 'initialize Client with cache file' do
Mtodos::Client.new('http://d.palmtb.net/_static/glaneuses.json')
Mtodos::Client.new('https://udd.debian.org/dmd/?email1=mkouhei%40palmtb.net&format=json#todo')
expect(File.exist?('mtodos.cache')).to eq(true)
end
end
239 changes: 239 additions & 0 deletions spec/udd.debian.org.json
@@ -0,0 +1,239 @@
[
{
":shortname": "rc_std_ae0b0e7487e87af44c1b78efbbec037c",
":type": "RC bug",
":source": "blockdiag",
":link": "http://bugs.debian.org/796371",
":description": "RC bug needs fixing",
":details": "#796371: blockdiag: FTBFS: unknown format: SVG",
":updated": {
"^t": 1441802898
},
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "rc_std_f091c6a1583a4f3648991ad47b67501a",
":type": "RC bug",
":source": "nwdiag",
":link": "http://bugs.debian.org/796429",
":description": "RC bug needs fixing",
":details": "#796429: nwdiag: FTBFS: TypeError: &#39;NoneType&#39; object is not callable",
":updated": {
"^t": 1441802896
},
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "rc_std_87b5328fc6e4b58d7da73dd6ebae9997",
":type": "RC bug",
":source": "seqdiag",
":link": "http://bugs.debian.org/796481",
":description": "RC bug needs fixing",
":details": "#796481: seqdiag: FTBFS: TypeError: coercing to Unicode: need string or buffer, bool found",
":updated": {
"^t": 1441846446
},
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "rc_std_c8f7be813b60241bc590926f86cd0f7d",
":type": "RC bug",
":source": "actdiag",
":link": "http://bugs.debian.org/798547",
":description": "RC bug needs fixing",
":details": "#798547: actdiag: FTBFS: TypeError: coercing to Unicode: need string or buffer, bool found",
":updated": {
"^t": 1441891986
},
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "vcs_a586b5acb5a2f9f22e6fabe567fe5bc4",
":type": "vcs",
":source": "backup2swift",
":link": "http://anonscm.debian.org/gitweb/?p=openstack/backup2swift.git",
":description": "New version",
":details": " ready for upload",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_fe0e468b3f010271c7a6963bd4727efb",
":type": "uscan error",
":source": "sphinxcontrib-nwdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n http://pypi.python.org/packages/source/s/sphinxcontrib-nwdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_488f3d00e30247919fb99edffd0f5d8e",
":type": "uscan error",
":source": "sphinxcontrib-blockdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n http://pypi.python.org/packages/source/s/sphinxcontrib-blockdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_26c5c686a73948e03ed5f77353e0e8a0",
":type": "uscan error",
":source": "nwdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n https://pypi.python.org/packages/source/n/nwdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_1c978829f67c21014a3665f00232013b",
":type": "uscan error",
":source": "swiftsc",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n http://pypi.python.org/packages/source/s/swiftsc/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "newupstream_0ad0e1e9912b4e1745864456991a7901",
":type": "new upstream",
":source": "django-shortuuidfield",
":link": null,
":description": "New version available",
":details": "0.1.3",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_5b48e0fa6a7d5d87abde7ff709e58086",
":type": "uscan error",
":source": "backup2swift",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n http://pypi.python.org/packages/source/b/backup2swift/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_c81f8694c8b2e63bfdeea18319e0384a",
":type": "uscan error",
":source": "blockdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n https://pypi.python.org/packages/source/b/blockdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_cf1434bf751dcd7215b39f61493d7d6e",
":type": "uscan error",
":source": "sphinxcontrib-seqdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n http://pypi.python.org/packages/source/s/sphinxcontrib-seqdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "newupstream_6d5778f1a5fabcc09f4759c0c1cc521b",
":type": "new upstream",
":source": "django-guardian",
":link": null,
":description": "New version available",
":details": "1.3",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_97ef59e09d1ab5e07b2f5d32104148d2",
":type": "uscan error",
":source": "seqdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n https://pypi.python.org/packages/source/s/seqdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_ef1c4409d1a4ece692196f5d5d6f7067",
":type": "uscan error",
":source": "actdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n https://pypi.python.org/packages/source/a/actdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "scanerror_d008414a08dcfcafa14d35523bfb1991",
":type": "uscan error",
":source": "sphinxcontrib-actdiag",
":link": null,
":description": "debian/watch: uscan returned an error",
":details": "uscan warning: reading webpage\n http://pypi.python.org/packages/source/s/sphinxcontrib-actdiag/ failed: 404 Not Found",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_sphinxcontrib-nwdiag_0.9.0-1.1_1444394896",
":type": "testing auto-removal",
":source": "sphinxcontrib-nwdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: )",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_sphinxcontrib-blockdiag_1.5.0-1.1_1444394898",
":type": "testing auto-removal",
":source": "sphinxcontrib-blockdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: )",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_nwdiag_1.0.3-3_1444394896",
":type": "testing auto-removal",
":source": "nwdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: #796429)",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_blockdiag_1.4.7-1_1444394898",
":type": "testing auto-removal",
":source": "blockdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: #796371)",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_sphinxcontrib-seqdiag_0.8.0-1.1_1444394898",
":type": "testing auto-removal",
":source": "sphinxcontrib-seqdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: )",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_seqdiag_0.9.3-4_1444394898",
":type": "testing auto-removal",
":source": "seqdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: #796481)",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_actdiag_0.5.3-4_1444394898",
":type": "testing auto-removal",
":source": "actdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: )",
":reason": "Maintained by mkouhei@palmtb.net"
},
{
":shortname": "autoremoval_sphinxcontrib-actdiag_0.8.0-1.1_1444394898",
":type": "testing auto-removal",
":source": "sphinxcontrib-actdiag",
":link": null,
":description": "Testing auto-removal",
":details": "on 2015-10-09 (bug: )",
":reason": "Maintained by mkouhei@palmtb.net"
}
]

0 comments on commit 32b8af2

Please sign in to comment.