Esempio n. 1
0
 def test_static_npcprofession(self):
     """  """
     grafitti = Grafitti(self.redis, {'npcprofession': 'Spaceman'})
     self.assertEqual(
         'The following message is written in Gnomish with slime: "The warrior tried to protect us, but was too late..." The message is signed with a hand print. You\'d guess the message is less than a day old.',
         grafitti.text)
     self.assertEqual('Spaceman', grafitti.npcprofession)
Esempio n. 2
0
def generategrafitti():
    """Generate a grafitti"""

    features = feature_filter('grafitti')
    titletext = 'Scrawled on a Nearby Wall...'
    features['npc'] = NPC(app.server, {})
    if ('count' in request.args and valid_count(request.args['count'])):
        grafittis = []
        for _ in xrange(int(request.args['count'])):
            grafittis.append(Grafitti(app.server, features))
            features['seed'] = set_seed()
        return render_template('oneliner.html', oneliners=grafittis,
                               oneliner=grafittis[0], titletext=titletext, generator='grafitti')
    else:
        grafitti = Grafitti(app.server, features)
        return render_template('oneliner.html', oneliner=grafitti, titletext=titletext, generator='grafitti')
Esempio n. 3
0
 def test_static_npc(self):
     """  """
     npc = NPC(self.redis)
     grafitti = Grafitti(self.redis, {'npc': npc})
     self.assertEqual(
         'The following message is written in Gnomish with slime: "The warrior tried to protect us, but was too late..." The message is signed with a hand print. You\'d guess the message is less than a day old.',
         grafitti.text)
     self.assertEqual('Tom', grafitti.npcname)
Esempio n. 4
0
 def test_random_grafitti(self):
     """  """
     grafitti = Grafitti(self.redis)
     self.assertEqual(
         'The following message is written in Gnomish with slime: "The warrior tried to protect us, but was too late..." The message is signed with a hand print. You\'d guess the message is less than a day old.',
         grafitti.text)
     self.assertEqual(
         'The following message is written in Gnomish with slime: "The warrior tried to protect us, but was too late..." The message is signed with a hand print. You\'d guess the message is less than a day old.',
         str(grafitti))
Esempio n. 5
0
 def test_static_age(self):
     """  """
     grafitti = Grafitti(self.redis, {'age': 'super old.'})
     self.assertIn("You'd guess the message is super old.", str(grafitti))
Esempio n. 6
0
 def test_static_signature(self):
     """  """
     grafitti = Grafitti(self.redis, {'signature': 'by the crazy guy.'})
     self.assertIn('by the crazy guy.', str(grafitti))
Esempio n. 7
0
 def test_static_text(self):
     """  """
     grafitti = Grafitti(self.redis, {'text': 'Nothing good.'})
     self.assertEqual('Nothing good.', str(grafitti))