예제 #1
0
class SequenceIntegerProviderTest(unittest.TestCase):
  """Test class for SequenceIntegerProvider.
  """

  def setUp(self):
    self.provider = SequenceIntegerProvider()


  def tearDown(self):
    pass

  def testGetValue(self):
    """Tests getValue()
    """
    name = 'test'
    self.provider.param_values = {'name': name}

    next = self.provider.DEFAULT_START
    self.assertEquals(self.provider.getValue(), next)

    next = next + self.provider.DEFAULT_STEP
    self.assertEquals(self.provider.getValue(), next)

    next = next + self.provider.DEFAULT_STEP
    self.assertEquals(self.provider.getValue(), next)

  def testGetValueWithInvalidParameters(self):
    """Tests getValue() with invalid parameters.
    """
    self.assertRaises(MissingParameterError, self.provider.getValue)

    name = 'test'
    start = "asdf"
    step = None

    self.provider.param_values = {'name': name, 'start': start, 'step': step}
    self.assertRaises(ParameterValueError, self.provider.getValue)
예제 #2
0
 def setUp(self):
   self.provider = SequenceIntegerProvider()