def test_message_db_json(self): spirit1 = Factory.spirit() message1 = Factory.message(spirit=spirit1, status=Message.Status.LIVE) message2 = Factory.message(spirit=spirit1, status=Message.Status.LIVE) spirit2 = Factory.spirit() message3 = Factory.message(spirit=spirit1, status=Message.Status.LIVE) message4 = Factory.message(spirit=spirit2, status=Message.Status.LIVE) response = self.client.post(reverse('message_db_json'), { u'spirits': (spirit1.name, spirit2.name), }) db = json.loads(response.content) assert_equal(db['result'], 'ok') assert spirit1.name in db.keys() assert spirit2.name in db.keys()
def test_spirit_random_message(self): message = Factory.message(status=Message.Status.LIVE) response = self.client.get(reverse('spirit_random_message', kwargs={'spirit':message.spirit.slug})) assert_equal(response.status_code, 200)