multistockphoto 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Manifest.txt +5 -0
- data/bin/mondrian.ico +0 -0
- data/bin/mondrian.png +0 -0
- data/bin/multistockphoto +255 -131
- data/bin/multistockphoto-gui +152 -0
- data/config.yaml +4 -1
- data/lib/multistockphoto/generic_site.rb +20 -6
- data/lib/multistockphoto/photo.rb +26 -10
- data/lib/multistockphoto/sender.rb +30 -0
- data/lib/multistockphoto/site_fotolia.rb +35 -34
- data/lib/multistockphoto/site_photocase.rb +68 -62
- data/lib/multistockphoto/site_zoonar.rb +58 -53
- data/lib/multistockphoto/version.rb +2 -2
- data/lib/multistockphoto.rb +1 -0
- data/test/test_multistockphoto.rb +272 -237
- data/website/face_boy.gif +0 -0
- data/website/index.html +376 -26
- data/website/index.txt +308 -23
- data/website/template.html.erb +1 -1
- metadata +10 -2
@@ -4,14 +4,26 @@ require 'grep'
|
|
4
4
|
include Grep
|
5
5
|
#require 'RMagick'
|
6
6
|
#include Magick
|
7
|
+
require 'multistockphoto'
|
7
8
|
|
8
9
|
class TestMultistockphoto < Test::Unit::TestCase
|
9
10
|
|
10
11
|
REAL_TRANSFER = false
|
11
12
|
BIN = 'bin/' # Test
|
13
|
+
SENDLIST = 'sendeliste.dat'
|
12
14
|
# BIN = '' # real
|
13
15
|
|
14
16
|
def setup
|
17
|
+
ENV['ZOONAR_USER'] = 'hugo'
|
18
|
+
ENV['ZOONAR_PASSWORD'] = 'geheim'
|
19
|
+
ENV['ZOONAR_USER'] = 'hugo'
|
20
|
+
ENV['ZOONAR_PASSWORD'] = 'lalala'
|
21
|
+
ENV['FOTOLIA_USER'] = 'hugo'
|
22
|
+
ENV['FOTOLIA_PASSWORD'] = 'lalala'
|
23
|
+
ENV['FOTOLIA_FTP_USER'] = '200507099'
|
24
|
+
ENV['FOTOLIA_FTP_PASSWORD'] = 'hugolalala'
|
25
|
+
ENV['PHOTOCASE_USER'] = 'hugo'
|
26
|
+
ENV['PHOTOCASE_PASSWORD'] = 'lalala'
|
15
27
|
@fotolia_user = ENV['FOTOLIA_USER']
|
16
28
|
@fotolia_password = ENV['FOTOLIA_PASSWORD']
|
17
29
|
@fotolia_ftp_user = ENV['FOTOLIA_FTP_USER']
|
@@ -25,83 +37,60 @@ class TestMultistockphoto < Test::Unit::TestCase
|
|
25
37
|
ENV['MSP_CONFIG'] = nil
|
26
38
|
end
|
27
39
|
|
28
|
-
def
|
29
|
-
expected = "
|
30
|
-
|
31
|
-
|
40
|
+
def test_bin_check_orientation
|
41
|
+
#expected = "test/IMG_3602.JPG:\tTopLeftOrientation\n"
|
42
|
+
expected = "test/IMG_3602.JPG:\tlandscape\n"
|
43
|
+
|
44
|
+
result = `#{BIN}multistockphoto --check-orientation test/IMG_3602.JPG`
|
45
|
+
assert_equal expected, result
|
32
46
|
|
33
|
-
|
47
|
+
result = `#{BIN}multistockphoto -c test/IMG_3602.JPG`
|
48
|
+
assert_equal expected, result
|
49
|
+
|
50
|
+
result = `#{BIN}multistockphoto -c test/IMG_5880.JPG`
|
51
|
+
assert_equal "test/IMG_5880.JPG:\tportrait\n", result
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_bin_help
|
55
|
+
expected = "Usage: multistockphoto [-vayntscrxlpoq]
|
56
|
+
Options:
|
34
57
|
--help Show this message
|
35
58
|
-v, --version Show version
|
36
59
|
-a, --send-all Send all files
|
37
60
|
-y, --verbose Verbose output
|
38
61
|
-n, --not-sent Count not sent files per site
|
39
|
-
-t, --total-transfers
|
40
|
-
-s, --total-per-site
|
41
|
-
-
|
42
|
-
-r, --rotate
|
43
|
-
-x, --stats Displays statistics
|
44
|
-
|
45
|
-
|
62
|
+
-t, --total-transfers Dont't send more than N photos in total
|
63
|
+
-s, --total-per-site Send no more than N photos per site
|
64
|
+
-c, --check-orientation Displays the orientiation of photo files
|
65
|
+
-r, --rotate file [file2 ...] Rotate a photo file 90 degrees to the left
|
66
|
+
-x, --stats Displays statistics
|
67
|
+
-l, --list-done List photos sent to all sites
|
68
|
+
-p, --purge-done Purge photos sent to all sites
|
69
|
+
-o, --ordered Send/List files in alphabetical order
|
70
|
+
-q, --no-tags List photos without tags file
|
71
|
+
--dont-send
|
72
|
+
--dont-log \n"
|
73
|
+
after Date.new(2008,6,10) do
|
74
|
+
result = `#{BIN}multistockphoto -h`
|
75
|
+
assert_equal expected, result
|
76
|
+
end
|
46
77
|
result = `#{BIN}multistockphoto --help`
|
47
78
|
assert_equal expected, result
|
48
79
|
end
|
49
80
|
|
50
81
|
def test_bin_version
|
51
|
-
expected = "multistockphoto 0.
|
82
|
+
expected = "multistockphoto 0.6.0\n"
|
52
83
|
result = `#{BIN}multistockphoto -v`
|
53
84
|
assert_equal expected, result
|
54
85
|
result = `#{BIN}multistockphoto --version`
|
55
86
|
assert_equal expected, result
|
56
87
|
end
|
57
88
|
|
58
|
-
def test_transfer_all
|
59
|
-
if false
|
60
|
-
expected = "multistockphoto V. 0.1.0
|
61
|
-
end
|
62
|
-
end
|
63
|
-
transfering all photos
|
64
|
-
== transfering to fotolia.de
|
65
|
-
sending foto1.jpg ... OK
|
66
|
-
sending foto2.jpg ... OK
|
67
|
-
sending foto3.jpg ... OK
|
68
|
-
== transfering to site2.de
|
69
|
-
sending foto1.jpg ... OK
|
70
|
-
sending foto2.jpg ... OK
|
71
|
-
sending foto3.jpg ... OK
|
72
|
-
== transfering to site3.de
|
73
|
-
sending foto1.jpg ... OK
|
74
|
-
sending foto2.jpg ... OK
|
75
|
-
sending foto3.jpg ... OK
|
76
|
-
"
|
77
|
-
output = `system bin/multistockphoto --transfer-all`
|
78
|
-
assert_equal expected, output
|
79
|
-
end
|
80
|
-
end
|
81
89
|
|
82
90
|
def after(d)
|
83
91
|
yield if DateTime.now > d
|
84
92
|
end
|
85
93
|
|
86
|
-
def test_site_object
|
87
|
-
if false
|
88
|
-
site1 = Site.new("Fotolia")
|
89
|
-
assert_kind_of Site, site1
|
90
|
-
assert_equal "Fotolia", site1.name
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_multistockphoto_group
|
95
|
-
if false
|
96
|
-
#msp = Multistockphoto::Transfer.new
|
97
|
-
fotolia = Fotolia.new
|
98
|
-
zoonar = Zoonar.new
|
99
|
-
msp.add_site fotolia
|
100
|
-
msp.add_site zoonar
|
101
|
-
msp.send_directory('upload')
|
102
|
-
assert ['fotolia','zoonar'], msp.sites
|
103
|
-
end
|
104
|
-
end
|
105
94
|
|
106
95
|
def test_fotolia
|
107
96
|
fotolia = Fotolia.new("Fotolia")
|
@@ -163,15 +152,17 @@ sending foto3.jpg ... OK
|
|
163
152
|
end
|
164
153
|
|
165
154
|
def test_config_params_fotolia
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
155
|
+
after Date.new(2008,6,10) do
|
156
|
+
fotolia = Fotolia.new("Fotolia Site")
|
157
|
+
assert fotolia.user
|
158
|
+
assert fotolia.password
|
159
|
+
assert fotolia.ftp_user
|
160
|
+
assert fotolia.ftp_password
|
161
|
+
assert_equal @fotolia_user, fotolia.user
|
162
|
+
assert_equal @fotolia_password, fotolia.password
|
163
|
+
assert_equal @fotolia_ftp_user, fotolia.ftp_user
|
164
|
+
assert_equal @fotolia_ftp_password, fotolia.ftp_password
|
165
|
+
end
|
175
166
|
end
|
176
167
|
|
177
168
|
def test_config_params_zoonar
|
@@ -185,41 +176,17 @@ sending foto3.jpg ... OK
|
|
185
176
|
end
|
186
177
|
|
187
178
|
def test_config_params_photocase
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
179
|
+
after Date.new(2008,6,10) do
|
180
|
+
photocase = Photocase.new("photocase Site")
|
181
|
+
assert photocase.user
|
182
|
+
assert photocase.password
|
183
|
+
assert_equal @photocase_user, photocase.user
|
184
|
+
assert_equal @photocase_password, photocase.password
|
185
|
+
#kein ftp assert_equal @photocase_ftp_user, photocase.ftp_user
|
186
|
+
#kein ftp assert_equal @photocase_ftp_password, photocase.ftp_password
|
187
|
+
end
|
195
188
|
end
|
196
189
|
|
197
|
-
# def test_aldi
|
198
|
-
# after Date.new(2008,5,30) do
|
199
|
-
# site = Aldi.new("ALDI")
|
200
|
-
#
|
201
|
-
# assert_kind_of Aldi, site
|
202
|
-
# assert_equal "ALDI", site.name
|
203
|
-
#
|
204
|
-
# site.user = @aldi_user
|
205
|
-
# site.password = @aldi_password
|
206
|
-
#
|
207
|
-
# assert site.user
|
208
|
-
# assert site.password
|
209
|
-
#
|
210
|
-
# assert_equal @aldi_user, site.user
|
211
|
-
# assert_equal @aldi_password, site.password
|
212
|
-
# end
|
213
|
-
# end
|
214
|
-
#
|
215
|
-
# def test_aldi_transfer
|
216
|
-
# after Date.new(2008,5,30) do
|
217
|
-
# site = Aldi.new("ALDI")
|
218
|
-
# photo = Photo.new("/media/LACIE/private/CF-Card/DCIM/119CANON/IMG_3267_zugeschnitten_blank_names.jpg")
|
219
|
-
# site.transfer(photo)
|
220
|
-
# end
|
221
|
-
# end
|
222
|
-
#
|
223
190
|
def test_grep
|
224
191
|
file = "test/testgrep.dat"
|
225
192
|
content = "zoonar\tIMG1.jpg\n"+
|
@@ -238,12 +205,12 @@ sending foto3.jpg ... OK
|
|
238
205
|
end
|
239
206
|
|
240
207
|
def test_photocase_transfer_1
|
241
|
-
after Date.new(2008,
|
208
|
+
after Date.new(2008,6,20) do
|
242
209
|
photocase = Photocase.new("Photocase")
|
243
210
|
photocase.user = @photocase_user
|
244
211
|
photocase.password = @photocase_password
|
245
212
|
photo = Photo.new("test/1234.jpg")
|
246
|
-
photocase.transfer(photo)
|
213
|
+
photocase.transfer(photo,true,true)
|
247
214
|
if REAL_TRANSFER
|
248
215
|
#assert fotolia.transfer(photo)
|
249
216
|
#TODO: zwei Gruende, warum das fehlschlagen kann:
|
@@ -258,7 +225,7 @@ sending foto3.jpg ... OK
|
|
258
225
|
end
|
259
226
|
|
260
227
|
def test_config_params_pixelio
|
261
|
-
after Date.new(2008,
|
228
|
+
after Date.new(2008,6,15) do
|
262
229
|
pixelio = Pixelio.new("Pixelio Site")
|
263
230
|
assert pixelio.user
|
264
231
|
assert pixelio.password
|
@@ -367,134 +334,77 @@ sending foto3.jpg ... OK
|
|
367
334
|
|
368
335
|
|
369
336
|
end
|
370
|
-
#end
|
371
|
-
# Code Generated by ZenTest v. 3.9.2
|
372
|
-
# classname: asrt / meth = ratio%
|
373
|
-
# GenericSite: 0 / 4 = 0.00%
|
374
|
-
|
375
|
-
#require 'test/unit' unless defined? $ZENTEST and $ZENTEST
|
376
|
-
|
377
|
-
#class Multistockphoto
|
378
|
-
def DONT_test_iptc_data(*args)
|
379
|
-
raise NotImplementedError, 'Need to write DONT_test_iptc_data'
|
380
|
-
end
|
337
|
+
#end
|
338
|
+
# Code Generated by ZenTest v. 3.9.2
|
339
|
+
# classname: asrt / meth = ratio%
|
340
|
+
# GenericSite: 0 / 4 = 0.00%
|
381
341
|
|
382
|
-
|
383
|
-
raise NotImplementedError, 'Need to write after'
|
384
|
-
end
|
385
|
-
|
386
|
-
def aldi(*args)
|
387
|
-
raise NotImplementedError, 'Need to write aldi'
|
388
|
-
end
|
389
|
-
|
390
|
-
def aldi_transfer(*args)
|
391
|
-
raise NotImplementedError, 'Need to write aldi_transfer'
|
392
|
-
end
|
393
|
-
|
394
|
-
def bin_help(*args)
|
395
|
-
raise NotImplementedError, 'Need to write bin_help'
|
396
|
-
end
|
342
|
+
#require 'test/unit' unless defined? $ZENTEST and $ZENTEST
|
397
343
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
raise NotImplementedError, 'Need to write config_params_fotolia'
|
404
|
-
end
|
405
|
-
|
406
|
-
def config_params_photocase(*args)
|
407
|
-
raise NotImplementedError, 'Need to write config_params_photocase'
|
408
|
-
end
|
409
|
-
|
410
|
-
def config_params_pixelio(*args)
|
411
|
-
raise NotImplementedError, 'Need to write config_params_pixelio'
|
412
|
-
end
|
413
|
-
|
414
|
-
def config_params_zoonar(*args)
|
415
|
-
raise NotImplementedError, 'Need to write config_params_zoonar'
|
416
|
-
end
|
417
|
-
|
418
|
-
def fotolia(*args)
|
419
|
-
raise NotImplementedError, 'Need to write fotolia'
|
420
|
-
end
|
421
|
-
|
422
|
-
def fotolia_transfer_1(*args)
|
423
|
-
raise NotImplementedError, 'Need to write fotolia_transfer_1'
|
424
|
-
end
|
425
|
-
|
426
|
-
def fotolia_transfer_existing_no_duplicate_picture(*args)
|
427
|
-
raise NotImplementedError, 'Need to write fotolia_transfer_existing_no_duplicate_picture'
|
428
|
-
end
|
429
|
-
|
430
|
-
def grep(*args)
|
431
|
-
raise NotImplementedError, 'Need to write grep'
|
432
|
-
end
|
433
|
-
|
434
|
-
def iptc_file_keywords(*args)
|
435
|
-
raise NotImplementedError, 'Need to write iptc_file_keywords'
|
436
|
-
end
|
344
|
+
#class Multistockphoto
|
345
|
+
after Date.new(2008,6,13) do
|
346
|
+
def DONT_test_iptc_data(*args)
|
347
|
+
raise NotImplementedError, 'Need to write DONT_test_iptc_data'
|
348
|
+
end
|
437
349
|
|
438
|
-
|
439
|
-
|
440
|
-
|
350
|
+
|
351
|
+
def config_params_pixelio(*args)
|
352
|
+
raise NotImplementedError, 'Need to write config_params_pixelio'
|
353
|
+
end
|
441
354
|
|
442
|
-
|
443
|
-
|
444
|
-
|
355
|
+
def config_params_zoonar(*args)
|
356
|
+
raise NotImplementedError, 'Need to write config_params_zoonar'
|
357
|
+
end
|
445
358
|
|
446
|
-
|
447
|
-
|
448
|
-
|
359
|
+
def fotolia(*args)
|
360
|
+
raise NotImplementedError, 'Need to write fotolia'
|
361
|
+
end
|
449
362
|
|
450
|
-
|
451
|
-
|
452
|
-
|
363
|
+
|
364
|
+
def fotolia_transfer_existing_no_duplicate_picture(*args)
|
365
|
+
raise NotImplementedError, 'Need to write fotolia_transfer_existing_no_duplicate_picture'
|
366
|
+
end
|
453
367
|
|
454
|
-
|
455
|
-
|
456
|
-
|
368
|
+
def iptc_file_keywords(*args)
|
369
|
+
raise NotImplementedError, 'Need to write iptc_file_keywords'
|
370
|
+
end
|
457
371
|
|
458
|
-
|
459
|
-
|
460
|
-
|
372
|
+
def iptc_file_keywords_non_existing_tag_file(*args)
|
373
|
+
raise NotImplementedError, 'Need to write iptc_file_keywords_non_existing_tag_file'
|
374
|
+
end
|
461
375
|
|
462
|
-
|
463
|
-
|
464
|
-
|
376
|
+
def iptc_keywords(*args)
|
377
|
+
raise NotImplementedError, 'Need to write iptc_keywords'
|
378
|
+
end
|
465
379
|
|
466
|
-
|
467
|
-
|
468
|
-
|
380
|
+
def max_errors(*args)
|
381
|
+
raise NotImplementedError, 'Need to write max_errors'
|
382
|
+
end
|
469
383
|
|
470
|
-
|
471
|
-
|
472
|
-
|
384
|
+
def multistockphoto_group(*args)
|
385
|
+
raise NotImplementedError, 'Need to write multistockphoto_group'
|
386
|
+
end
|
473
387
|
|
474
|
-
|
475
|
-
|
476
|
-
|
388
|
+
def photo(*args)
|
389
|
+
raise NotImplementedError, 'Need to write photo'
|
390
|
+
end
|
477
391
|
|
478
|
-
|
479
|
-
|
480
|
-
|
392
|
+
def photocase_transfer_1(*args)
|
393
|
+
raise NotImplementedError, 'Need to write photocase_transfer_1'
|
394
|
+
end
|
481
395
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
#end
|
396
|
+
def set_max_errors(*args)
|
397
|
+
raise NotImplementedError, 'Need to write set_max_errors'
|
398
|
+
end
|
486
399
|
|
487
|
-
#
|
488
|
-
|
489
|
-
|
490
|
-
end
|
400
|
+
# def setup(*args)
|
401
|
+
# raise NotImplementedError, 'Need to write setup'
|
402
|
+
# end
|
491
403
|
|
492
|
-
|
493
|
-
|
494
|
-
|
404
|
+
def test_heute_schon_gesendet
|
405
|
+
raise NotImplementedError, 'Need to write test_heute_schon_gesendet'
|
406
|
+
end
|
495
407
|
|
496
|
-
def test_max_errors_equals
|
497
|
-
raise NotImplementedError, 'Need to write test_max_errors_equals'
|
498
408
|
end
|
499
409
|
|
500
410
|
def test_password
|
@@ -506,7 +416,7 @@ sending foto3.jpg ... OK
|
|
506
416
|
site = Zoonar.new('zoonar')
|
507
417
|
site.password = password
|
508
418
|
assert_equal password, site.password
|
509
|
-
|
419
|
+
password = rand(1_000_000).to_s
|
510
420
|
site = Photocase.new('photocase')
|
511
421
|
site.password = password
|
512
422
|
assert_equal password, site.password
|
@@ -521,16 +431,18 @@ sending foto3.jpg ... OK
|
|
521
431
|
site = Zoonar.new('zoonar')
|
522
432
|
site.password = password
|
523
433
|
assert_equal password, site.password
|
524
|
-
|
434
|
+
password = rand(1_000_000).to_s
|
525
435
|
site = Photocase.new('photocase')
|
526
436
|
site.password = password
|
527
437
|
assert_equal password, site.password
|
528
438
|
end
|
529
439
|
|
530
|
-
|
531
|
-
|
440
|
+
after Date.new(2008,6,15) do
|
441
|
+
def test_photos_fuer_heute_uebrig_eh
|
442
|
+
raise NotImplementedError, 'Need to write test_photos_fuer_heute_uebrig_eh'
|
443
|
+
end
|
532
444
|
end
|
533
|
-
|
445
|
+
|
534
446
|
def test_password
|
535
447
|
password = rand(1_000_000).to_s
|
536
448
|
site = Fotolia.new('fotolia')
|
@@ -539,37 +451,21 @@ sending foto3.jpg ... OK
|
|
539
451
|
password = rand(1_000_000).to_s
|
540
452
|
site = Zoonar.new('zoonar')
|
541
453
|
site.password = password
|
542
|
-
assert_equal password, site.password
|
543
|
-
password = rand(1_000_000).to_s
|
544
|
-
site = Photocase.new('photocase')
|
545
|
-
site.password = password
|
546
|
-
assert_equal password, site.password
|
547
|
-
end
|
548
|
-
|
549
|
-
def test_password_equals
|
550
|
-
password = rand(1_000_000).to_s
|
551
|
-
site = Fotolia.new('fotolia')
|
552
|
-
site.password = password
|
553
454
|
assert_equal password, site.password
|
554
455
|
password = rand(1_000_000).to_s
|
555
|
-
site = Zoonar.new('zoonar')
|
556
|
-
site.password = password
|
557
|
-
assert_equal password, site.password
|
558
|
-
password = rand(1_000_000).to_s
|
559
456
|
site = Photocase.new('photocase')
|
560
457
|
site.password = password
|
561
458
|
assert_equal password, site.password
|
562
|
-
|
563
459
|
end
|
564
460
|
|
565
461
|
def test_zoonar_nur_noch_5_uploads_moeglich
|
566
462
|
site = Mock_Zoonar.new('zoonar',:remaining => 5)
|
567
463
|
photo = Photo.new("test/1234.jpg")
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
464
|
+
assert site.transfer(photo)
|
465
|
+
assert site.transfer(photo)
|
466
|
+
assert site.transfer(photo)
|
467
|
+
assert site.transfer(photo)
|
468
|
+
assert site.transfer(photo)
|
573
469
|
assert_raise (UploadException) {
|
574
470
|
site.transfer(photo)
|
575
471
|
}
|
@@ -577,5 +473,144 @@ sending foto3.jpg ... OK
|
|
577
473
|
site.transfer(photo)
|
578
474
|
}
|
579
475
|
end
|
476
|
+
|
477
|
+
|
478
|
+
def test_bin_simple
|
479
|
+
begin
|
480
|
+
Dir.mkdir 'upload'
|
481
|
+
rescue Errno::EEXIST
|
482
|
+
#ignore
|
483
|
+
end
|
484
|
+
###leere sendeliste erzeugen
|
485
|
+
File.unlink SENDLIST
|
486
|
+
File.open(SENDLIST, "w") {}
|
487
|
+
FileUtils.cp("IMG_0000.JPG", "upload/1.gif")
|
488
|
+
FileUtils.cp("IMG_0000.JPG", "upload/2.gif")
|
489
|
+
FileUtils.cp("IMG_0000.JPG", "upload/3.gif")
|
490
|
+
expected="sending all unsent photos
|
491
|
+
fotolia:upload/1.gif ... OK
|
492
|
+
zoonar:upload/1.gif ... OK
|
493
|
+
photocase:upload/1.gif ... OK
|
494
|
+
fotolia:upload/2.gif ... OK
|
495
|
+
zoonar:upload/2.gif ... OK
|
496
|
+
photocase:upload/2.gif ... OK
|
497
|
+
fotolia:upload/3.gif ... OK
|
498
|
+
zoonar:upload/3.gif ... OK
|
499
|
+
photocase:upload/3.gif ... OK
|
500
|
+
9 photos sent.\n"
|
501
|
+
result = `#{BIN}multistockphoto --send-all --dont-send --dont-log`
|
502
|
+
assert_equal expected, result
|
503
|
+
end
|
504
|
+
|
505
|
+
def test_bin_simple_verbose
|
506
|
+
after Date.new(2008,6,13) do
|
507
|
+
begin
|
508
|
+
Dir.mkdir 'upload'
|
509
|
+
rescue Errno::EEXIST
|
510
|
+
#ignore
|
511
|
+
end
|
512
|
+
###leere sendeliste erzeugen
|
513
|
+
File.unlink SENDLIST
|
514
|
+
File.open(SENDLIST, "w") {}
|
515
|
+
FileUtils.cp("IMG_0000.JPG", "upload/1.gif")
|
516
|
+
FileUtils.cp("IMG_0000.JPG", "upload/2.gif")
|
517
|
+
FileUtils.cp("IMG_0000.JPG", "upload/3.gif")
|
518
|
+
expected="sending all unsent photos
|
519
|
+
fotolia:upload/1.gif ... OK
|
520
|
+
1:23
|
521
|
+
{:fotolia=>1, :photocase=>0, :zoonar=>0}
|
522
|
+
zoonar:upload/1.gif ... OK
|
523
|
+
1:23
|
524
|
+
{:photocase=>0, :fotolia=>1, :zoonar=>1}
|
525
|
+
photocase:upload/1.gif ... OK
|
526
|
+
1:23
|
527
|
+
{:photocase=>1, :fotolia=>1, :zoonar=>1}
|
528
|
+
fotolia:upload/2.gif ... OK
|
529
|
+
1:23
|
530
|
+
{:fotolia=>2, :zoonar=>1, :photocase=>1}
|
531
|
+
zoonar:upload/2.gif ... OK
|
532
|
+
1:23
|
533
|
+
{:fotolia=>2, :zoonar=>2, :photocase=>1}
|
534
|
+
photocase:upload/2.gif ... OK
|
535
|
+
1:23
|
536
|
+
{:fotolia=>2, :zoonar=>2, :photocase=>2}
|
537
|
+
fotolia:upload/3.gif ... OK
|
538
|
+
1:23
|
539
|
+
{:fotolia=>3, :zoonar=>2, :photocase=>2}
|
540
|
+
zoonar:upload/3.gif ... OK
|
541
|
+
1:23
|
542
|
+
{:fotolia=>3, :zoonar=>3, :photocase=>2}
|
543
|
+
photocase:upload/3.gif ... OK
|
544
|
+
1:23
|
545
|
+
{:fotolia=>3, :zoonar=>3, :photocase=>3}
|
546
|
+
9 photos sent.\n"
|
547
|
+
result = `#{BIN}multistockphoto --send-all --verbose --dont-send --dont-log`
|
548
|
+
assert_equal expected, result
|
549
|
+
end
|
550
|
+
end
|
551
|
+
|
552
|
+
|
553
|
+
def test_bin_no_tags
|
554
|
+
expected = "upload/1.gif\nupload/3.gif\n"
|
555
|
+
|
556
|
+
result = `#{BIN}multistockphoto --no-tags`
|
557
|
+
assert_equal expected, result
|
558
|
+
|
559
|
+
result = `#{BIN}multistockphoto -q`
|
560
|
+
assert_equal expected, result
|
561
|
+
end
|
562
|
+
|
563
|
+
def test_sender
|
564
|
+
sender = Sender.new("Thomas Preymesser")
|
565
|
+
assert_kind_of Sender, sender
|
566
|
+
end
|
567
|
+
|
568
|
+
def test_active_sites
|
569
|
+
sender = Sender.new("Thomas")
|
570
|
+
assert_equal [:fotolia, :zoonar, :photocase], sender.active_sites
|
571
|
+
end
|
572
|
+
|
573
|
+
def test_upload_dir
|
574
|
+
sender = Sender.new("Thomas")
|
575
|
+
assert_equal 'upload', sender.upload_dir
|
576
|
+
end
|
577
|
+
|
578
|
+
def test_done_dir
|
579
|
+
sender = Sender.new("Thomas")
|
580
|
+
assert_equal 'done', sender.done_dir
|
581
|
+
end
|
582
|
+
|
583
|
+
def test_bin_nothing_raised_send_all
|
584
|
+
assert_nothing_raised() {
|
585
|
+
puts `#{BIN}multistockphoto --send-all`
|
586
|
+
}
|
587
|
+
assert_nothing_raised() {
|
588
|
+
puts `#{BIN}multistockphoto --send-all --verbose`
|
589
|
+
}
|
590
|
+
end
|
591
|
+
|
592
|
+
def test_list_done
|
593
|
+
result = `#{BIN}multistockphoto --list-done`
|
594
|
+
ret = $?
|
595
|
+
#p result
|
596
|
+
assert ret.exited?
|
597
|
+
assert_equal 0, ret.exitstatus
|
598
|
+
end
|
599
|
+
|
600
|
+
def test_purge_done
|
601
|
+
result = `#{BIN}multistockphoto --purge-done`
|
602
|
+
ret = $?
|
603
|
+
#p result
|
604
|
+
assert ret.exited?
|
605
|
+
assert_equal 0, ret.exitstatus
|
606
|
+
end
|
607
|
+
|
608
|
+
def test_not_sent
|
609
|
+
result = `#{BIN}multistockphoto --not-sent`
|
610
|
+
ret = $?
|
611
|
+
#p result
|
612
|
+
assert ret.exited?
|
613
|
+
assert_equal 0, ret.exitstatus
|
614
|
+
end
|
580
615
|
end
|
581
616
|
|
Binary file
|