Revision 0559f745 test/ganeti.impexpd_unittest.py

b/test/ganeti.impexpd_unittest.py
111 111
      builder = impexpd.CommandBuilder(mode, opts, 1, 2, 3)
112 112
      self.assertRaises(errors.GenericError, builder.GetCommand)
113 113

  
114
  def testOptionLengthError(self):
115
    testopts = [
116
      CmdBuilderConfig(bind="0.0.0.0" + ("A" * impexpd.SOCAT_OPTION_MAXLEN),
117
                       port=1234, ca="/tmp/ca"),
118
      CmdBuilderConfig(host="localhost", port=1234,
119
                       ca="/tmp/ca" + ("B" * impexpd.SOCAT_OPTION_MAXLEN)),
120
      CmdBuilderConfig(host="localhost", port=1234,
121
                       key="/tmp/key" + ("B" * impexpd.SOCAT_OPTION_MAXLEN)),
122
      ]
123

  
124
    for opts in testopts:
125
      for mode in [constants.IEM_IMPORT, constants.IEM_EXPORT]:
126
        builder = impexpd.CommandBuilder(mode, opts, 1, 2, 3)
127
        self.assertRaises(errors.GenericError, builder.GetCommand)
128

  
129
      opts.host = "localhost" + ("A" * impexpd.SOCAT_OPTION_MAXLEN)
130
      builder = impexpd.CommandBuilder(constants.IEM_EXPORT, opts, 1, 2, 3)
131
      self.assertRaises(errors.GenericError, builder.GetCommand)
132

  
114 133
  def testModeError(self):
115 134
    mode = "foobarbaz"
116 135

  

Also available in: Unified diff