Skip to content
Browse files

setup for live monitor tests

 On branch master

	modified:   Rakefile
	modified:   bin/monitor/runtests
	new file:   test/monitor/live.coffee
	modified:   test/monitor/runtests.coffee
	modified:   test/monitor/test.coffee
  • Loading branch information...
1 parent b850695 commit 817841e1aef43218a3c2eaa11c07fba391878e41 @kixxauth kixxauth committed May 23, 2012
Showing with 48 additions and 16 deletions.
  1. +12 −0 Rakefile
  2. +1 −1 bin/monitor/runtests
  3. +7 −0 test/monitor/live.coffee
  4. +18 −0 test/monitor/runtests.coffee
  5. +10 −15 test/monitor/test.coffee
View
12 Rakefile
@@ -55,6 +55,18 @@ task :test => [:devsetup, :install] do
system 'sudo bin/monitor/runtests'
end
+desc "Run live Monitor tests"
+monitor_testlive_args = [
+ :mail_user,
+ :mail_pass,
+ :sms_user,
+ :sms_pass,
+ :sms_sender
+]
+task :testlive_monitor, monitor_testlive_args => [:devsetup, :install] do |task, args|
+ system "sudo bin/monitor/runtests #{args[:mail_user]} #{args[:mail_pass]} #{args[:sms_user]} #{args[:sms_pass]} #{args[:sms_sender]}"
+end
+
task :clean do
rm_rf 'node_modules'
rm_rf 'dist'
View
2 bin/monitor/runtests
@@ -3,4 +3,4 @@ THIS_DIR="$(cd `dirname $0` && pwd)"
BINDIR="$(dirname "$THIS_DIR")"
ROOT_DIR="$(dirname "$BINDIR")"
-coffee "$ROOT_DIR/test/monitor/runtests.coffee"
+coffee "$ROOT_DIR/test/monitor/runtests.coffee" $@
View
7 test/monitor/live.coffee
@@ -0,0 +1,7 @@
+describe 'live services', ->
+
+ it 'should', (done) ->
+ done()
+ return
+
+ return
View
18 test/monitor/runtests.coffee
@@ -3,7 +3,25 @@ PATH = require 'path'
TRM = require 'treadmill'
+LIVE = process.argv[2]
+
+if LIVE
+ global.TESTARGV =
+ mail_username: process.argv[2]
+ mail_password: process.argv[3]
+ sms_username: process.argv[4]
+ sms_password: process.argv[5]
+ sms_sender: process.argv[6]
+else
+ global.TESTARGV =
+ mail_username: 'firechief@fireworksproject.com'
+ mail_password: 'foobar'
+ sms_username: 'firechief'
+ sms_password: 'foobar'
+ sms_sender: '5555555555'
+
checkTestFile = (filename) ->
+ if LIVE then return /^live/.test(filename)
return /^test/.test(filename)
resolvePath = (filename) ->
View
25 test/monitor/test.coffee
@@ -48,20 +48,15 @@ describe 'mock functionality', ->
gMailCreateTransport = MAIL.createTransport
gSMSSession = SMS.Session
gMonitor = null
- gMailUsername = 'firechief@fireworksproject.com'
- gMailPassword = 'foobar'
- gFromEmail = "SAKS Monitor <#{gMailUsername}>"
+ gFromEmail = "SAKS Monitor <#{TESTARGV.mail_username}>"
gToEmail = 'foo@example.com, bar@example.com'
- gSMSUser = 'firechief'
- gSMSPass = 'foobar'
- gSMSAddress = '5555555555'
startMonitor = (callback) ->
args =
- MAIL_USERNAME: gMailUsername
- MAIL_PASSWORD: gMailPassword
- SMS_USERNAME: gSMSUser
- SMS_PASSWORD: gSMSPass
+ MAIL_USERNAME: TESTARGV.mail_username
+ MAIL_PASSWORD: TESTARGV.mail_password
+ SMS_USERNAME: TESTARGV.sms_username
+ SMS_PASSWORD: TESTARGV.sms_password
gMonitor = MON.monitor args, (err, monitor) ->
return callback(gMonitor)
return
@@ -82,9 +77,9 @@ describe 'mock functionality', ->
@expectCount(3)
SMS.Session = (spec) ->
- expect(spec.username).toBe(gSMSUser)
- expect(spec.password).toBe(gSMSPass)
- expect(spec.address).toBe(gSMSAddress)
+ expect(spec.username).toBe(TESTARGV.sms_username)
+ expect(spec.password).toBe(TESTARGV.sms_password)
+ expect(spec.address).toBe(TESTARGV.sms_sender)
return
startMonitor (monitor) ->
@@ -98,8 +93,8 @@ describe 'mock functionality', ->
MAIL.createTransport = (type, opts) ->
expect(type).toBe('SMTP')
expect(opts.service).toBe('Gmail')
- expect(opts.auth.user).toBe(gMailUsername)
- expect(opts.auth.pass).toBe(gMailPassword)
+ expect(opts.auth.user).toBe(TESTARGV.mail_username)
+ expect(opts.auth.pass).toBe(TESTARGV.mail_password)
transport = {}
transport.close = (callback) ->

0 comments on commit 817841e

Please sign in to comment.
Something went wrong with that request. Please try again.