def test_lucky_return_different_result_on_different_request(self): self._add_file('a.jpg') self._add_file('b.jpg') _1st = lucky() _2nd = lucky() self.assertNotEqual(_1st, None) self.assertNotEqual(_2nd, None) self.assertNotEqual(_1st, _2nd)
def test_lucky_return_None_if_no_more_file(self): self._add_file('a.jpg') self._add_file('b.jpg') lucky() lucky() self.assertEqual(lucky(), None)
def test_lucky_return_file_path_if_one_file(self): self._add_file('a.jpg') self.assertEqual(lucky(), 'upload/a.jpg')
def test_lucky_return_None_if_no_file(self): self.assertEqual(lucky(), None)