示例#1
0
 def test_help_commands(self):
     HEADING()
     help_commands = [("cloud", "cloud on", None),
                      ("flavor", "", "<"),
                      ("init", "KIND", None),
                      ("list", "projects", None),
                      ("rain", "KIND", None),
                      ("reservation", "duration", None),
                      ("storm", "ID", None),
                      ("vm", "CLOUD", "<"),
                      ("defaults", "clean", None),
                      ("image", "CLOUD", "<"),
                      ("inventory", "exists", None),
                      ("metric", "CLOUD", None),
                      ("register", "CLOUD", None),
                      ("security_group", "CLOUD", "<"),
                      ]
     allok = True
     for (command, valid, invalid) in help_commands:
         r = Shell.cm("help " + command)
         testing = True
         if valid is not None:
             testing = valid in r
         if invalid is not None:
             testing = testing and invalid not in r
         if testing:
             msg = "pass"
         else:
             msg = "fail"
         print("TESTING help", command, msg)
         allok = allok and testing
     assert allok
示例#2
0
 def grep_command(self, command, valid, invalid):
     ok = True
     r = Shell.cm(command)
     print(r)
     if valid is not None:
         for word in valid:
             msg = "passed"
             testing = word in r
             print("Testing", command, self.message(testing, word))
             ok = ok and testing
     if invalid is not None:
         for word in invalid:
             msg = "passed"
             testing = word not in r
             print("Testing", command, self.message(testing, word))
             ok = ok and testing
     return ok
示例#3
0
 def test_help(self):
     HEADING()
     r = Shell.cm("help")
     print(r)
     assert "vm" in r and "cloud" in r and "list" in r