def test_get_or_404_returns_paste_for_valid_string_id(self): Paste(id=1234).put() obj = Paste.get_or_404('1234') self.assertEqual(obj.key.id(), 1234)
def test_get_or_404_returns_paste_for_valid_integer_id(self): Paste(id=1234).put() obj = Paste.get_or_404(1234) self.assertEqual(obj.key.id(), 1234)
def test_get_or_404_with_bad_id(self): with self.assertRaises(Http404): Paste.get_or_404('bogus')
def test_get_or_404_with_unknown_id(self): self.assertIsNone(Paste.get_by_id(1234)) with self.assertRaises(Http404): Paste.get_or_404(1234)
def test_get_or_404_with_none_id(self): with self.assertRaises(Http404): Paste.get_or_404(None)