Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Add a CLI test for removing an application.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manfred committed Mar 11, 2011
1 parent 98eb09e commit 492a149
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
30 changes: 13 additions & 17 deletions test/passenger_pane/cli_test.nu
Expand Up @@ -41,37 +41,33 @@
(set @cli ((CLI alloc) init))
(@cli setPathToCLI:pathToCLI)
(@cli fakeAuthorize)
))

(it "adds a new application" (do ()

(set attributes (NSMutableDictionary dictionary))
(attributes setValue:"test.local" forKey:"host")
(attributes setValue:"assets.test.local" forKey:"aliases")
(attributes setValue:"/path/to/test" forKey:"path")
(attributes setValue:"production" forKey:"environment")
(attributes setValue:"/path/to/test.conf" forKey:"config_filename")
(set application ((Application alloc) initWithAttributes:attributes))

(@cli add:application)

(set @application ((Application alloc) initWithAttributes:attributes))
))

(it "adds a new application" (do ()
(@cli add:@application)
(set arguments (NSString stringWithContentsOfFile:pathToCLIArguments encoding:NSUTF8StringEncoding error:nil))
(~ arguments should equal:"[\"add\", \"/path/to/test\", \"-path\", \"/path/to/test\", \"-environment\", \"production\", \"-host\", \"test.local\", \"-config_filename\", \"/path/to/test.conf\", \"-aliases\", \"assets.test.local\"]")
))

(it "updates an application" (do ()
(set attributes (NSMutableDictionary dictionary))
(attributes setValue:"test.local" forKey:"host")
(attributes setValue:"assets.test.local" forKey:"aliases")
(attributes setValue:"/path/to/test" forKey:"path")
(attributes setValue:"production" forKey:"environment")
(attributes setValue:"/path/to/test.conf" forKey:"config_filename")
(set application ((Application alloc) initWithAttributes:attributes))

(@cli update:application)

(@cli update:@application)
(set arguments (NSString stringWithContentsOfFile:pathToCLIArguments encoding:NSUTF8StringEncoding error:nil))
(~ arguments should equal:"[\"update\", \"test.local\", \"-path\", \"/path/to/test\", \"-environment\", \"production\", \"-host\", \"test.local\", \"-config_filename\", \"/path/to/test.conf\", \"-aliases\", \"assets.test.local\"]")
))

(it "deletes an application" (do ()
(@cli delete:@application)
(set arguments (NSString stringWithContentsOfFile:pathToCLIArguments encoding:NSUTF8StringEncoding error:nil))
(~ arguments should equal:"[\"delete\", \"test.local\"]")
))
))

((Bacon sharedInstance) run)
2 changes: 1 addition & 1 deletion test/passenger_pane/fake_ppane/ppane
Expand Up @@ -5,7 +5,7 @@ require File.expand_path('../../../../lib/passenger_pane/trust', __FILE__)
command = ARGV[0]
if command == 'list'
puts '[{"framework":"rails","hosts":["manager.boom.local","account.boom.local"],"path":"\/Users\/manfred\/Code\/boommanager","config_filename":"\/private\/etc\/apache2\/passenger_pane_vhosts\/boommanager.local.vhost.conf","host":"manager.boom.local","aliases":"account.boom.local","environment":"development","vhost_address":"*:80","user_defined_data":"<Directory \"\/Users\/manfred\/Code\/boommanager\/public\">\n Order allow,deny\n Allow from all\n <\/Directory>"},{"framework":"rails","hosts":["scoring.boom.local"],"path":"\/Users\/manfred\/Code\/boomscoring","config_filename":"\/private\/etc\/apache2\/passenger_pane_vhosts\/boomscoring.local.vhost.conf","host":"scoring.boom.local","aliases":"","environment":"development","vhost_address":"*:80","user_defined_data":"<Directory \"\/Users\/manfred\/Code\/boomscoring\/public\">\n Order allow,deny\n Allow from all\n <\/Directory>"},{"framework":"rails","hosts":["diagnose.local"],"path":"\/Users\/manfred\/Code\/diagnose","config_filename":"\/private\/etc\/apache2\/passenger_pane_vhosts\/diagnose.local.vhost.conf","host":"diagnose.local","aliases":"","environment":"development","vhost_address":"*:80","user_defined_data":"<Directory \"\/Users\/manfred\/Code\/diagnose\/public\">\n Order allow,deny\n Allow from all\n <\/Directory>"}]'
elsif %w(add update restart).include?(command)
elsif %w(add update delete restart).include?(command)
require 'fileutils'
tmpdir = File.expand_path('../../../../tmp', __FILE__)
filename = File.join(tmpdir, '.test/args.txt')
Expand Down

0 comments on commit 492a149

Please sign in to comment.