Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / testing / tests / cli / telnetport.exp
1 #!/usr/bin/expect --
2 ################################################################################
3 #
4 # File:         telnetport.exp
5 # Description:  Tests telnetport command
6 # Author:       Andrew@DeFaria.com
7 # Created:      Fri Jun  6 15:37:15 PDT 2003
8 # Language:     Expect
9 # Test Class:   CLI
10 #
11 # (c) Copyright 2003, Andrew@DeFaria.com, all rights reserved
12 #
13 ################################################################################
14 set test_base "/dview/defaria_default/Tools/testing"
15
16 source "$test_base/bin/TestPkg.tcl"
17
18 catch {namespace import Test::*}
19
20 proc Setup {} {
21   Start "telnetport"
22
23   # Go to config prompt
24   send "config board 1\r"
25
26   expect {
27     $Test::success {
28     }
29     default {
30       Warning "Unable to get to board 1's prompt"
31     }
32   }
33 }
34
35 proc Run {} {
36   set Test::result 1
37
38   send "telnetport\r"
39
40   expect {
41     "succeeded" {
42       set Test::result 0
43     }
44     timeout {
45       set Test::reason "Timed out on telnetport!"
46     }
47     default {
48       set Test::reason "Defaulted on telnetport!"
49     }
50   }
51 }
52
53 proc CleanUp {} {
54   send "exit\r"
55
56   expect {
57     $Test::success {
58     }
59     default {
60       Warning "Unable to return to config prompt"
61     }
62   }
63
64   send "exit\r"
65
66   expect {
67     $Test::success {
68     }
69     default {
70       Warning "Unable to return to main prompt"
71     }
72   }
73
74   End
75 }
76
77 # Main
78 Setup
79 Run
80 CleanUp