Permalink
Browse files

fix potentially devastating bug related to deleted experiments

  • Loading branch information...
zackkitzmiller committed May 17, 2013
1 parent 8d6933c commit b3b50490fd3f9ad4afe4c1ab79b41352a3150e41
Showing with 11 additions and 1 deletion.
  1. +1 −1 sixpack/models.py
  2. +10 −0 sixpack/test/experiment_model_test.py
View
@@ -168,7 +168,7 @@ def delete(self):
pipe.delete(_key('e:{0}'.format(self.name)))
# Consider a 'non-keys' implementation of this
keys = self.redis.keys('*{0}*'.format(self.rawkey()))
keys = self.redis.keys('*:{0}:*'.format(self.name))
for key in keys:
pipe.delete(key)
@@ -82,6 +82,16 @@ def test_delete(self):
with self.assertRaises(ValueError):
Experiment.find('delete-me', self.redis)
def test_leaky_delete(self):
exp = Experiment('delete-me-1', self.alternatives, self.redis)
exp.save()
exp2 = Experiment('delete', self.alternatives, self.redis)
exp2.save()
exp2.delete()
exp3 = Experiment.find('delete-me-1', self.redis)
self.assertEqual(exp3.get_alternative_names(), self.alternatives)
def test_archive(self):
self.assertFalse(self.exp_1.is_archived())
self.exp_1.archive()

0 comments on commit b3b5049

Please sign in to comment.