Esempio n. 1
0
class RandomWordProviderTest(unittest.TestCase):
  """Test class for RandomWordProvider.
  """

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

  def testGetValue(self):
    """Tests getValue().
    """
    value = self.provider.getValue()
    self.assertTrue(value in self.provider.choices)

  def testGetUserSuppliedValue(self):
    """Tests getValue() with a user supplied list of choices.
    """
    choices = 'choice1,choice2,choice3'
    self.provider.param_values = {'choices': choices}
    value = self.provider.getValue()
    self.assertTrue(value in choices.split(','))

  def testEmptyChoices(self):
    """Tests getValue() with an empty choices list.
    """
    choices = ''
    self.provider.param_values = {'choices': choices}
    value = self.provider.getValue()
    self.assertEquals(value, '')
Esempio n. 2
0
 def getValue(self):
     link = "http://www."
     link += RandomWordProvider.getValue(self)
     link += "."
     link += random.choice(["com", "org", "net"])
     link += "/"
     for _ in range(random.randint(0, 3)):
         link += RandomWordProvider.getValue(self) + "/"
     return link
Esempio n. 3
0
 def getValue(self):
   link = 'http://www.'
   link += RandomWordProvider.getValue(self)
   link += '.'
   link += random.choice(['com', 'org', 'net'])
   link += '/'
   for _ in range(random.randint(0, 3)):
     link += RandomWordProvider.getValue(self) + '/'
   return link
Esempio n. 4
0
 def getValue(self):
   link = 'http://www.'
   link += RandomWordProvider.getValue(self)
   link += '.'
   link += random.choice(['com', 'org', 'net'])
   link += '/'
   for _ in range(random.randint(0, 3)):
     link += RandomWordProvider.getValue(self) + '/'
   return link
Esempio n. 5
0
 def setUp(self):
   self.provider = RandomWordProvider()