Exemplo n.º 1
0
 def test_two_directories(self):
     """Patches with the same name should only be run once"""
     run()  # Use value from settings
     run(directory='sql-patches')
     p = Species.objects.filter(genus='Eudynamys')
     print[str(x) for x in p]
     self.assertEqual(len(p), 2)
Exemplo n.º 2
0
 def test_remove_all_patches(self):
     """'clean' removes all patch records from the database"""
     p = Patch.objects.all()
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
     clean()
     self.assertEqual(len(Patch.objects.all()), 0)
Exemplo n.º 3
0
 def test_remove_all_patches(self):
     """'clean' removes all patch records from the database"""
     p = Patch.objects.all()
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
     clean()
     self.assertEqual(len(Patch.objects.all()), 0)
Exemplo n.º 4
0
 def test_run_twice_times(self):
     """Test that running cuckoo twice doesn't change the times"""
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
     t1 = [x.last_modified for x in Patch.objects.all()]
     run()
     t2 = [x.last_modified for x in Patch.objects.all()]
     for i in range(len(t1)):
         self.assertEqual(t1[i], t2[i]) #Running twice didn't change the last_modified times
Exemplo n.º 5
0
 def test_fake_times(self):
     """Test that running 'fake' does nothing if teh patches have already been run"""
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
     t1 = [x.last_modified for x in Patch.objects.all()]
     fake()
     t2 = [x.last_modified for x in Patch.objects.all()]
     for i in range(len(t1)):
         self.assertEqual(t1[i], t2[i]) #Running fake didn't change the last_modified times
Exemplo n.º 6
0
 def test_fake_times(self):
     """Test that running 'fake' does nothing if teh patches have already been run"""
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
     t1 = [x.last_modified for x in Patch.objects.all()]
     fake()
     t2 = [x.last_modified for x in Patch.objects.all()]
     for i in range(len(t1)):
         self.assertEqual(
             t1[i],
             t2[i])  #Running fake didn't change the last_modified times
Exemplo n.º 7
0
 def test_run_twice_times(self):
     """Test that running cuckoo twice doesn't change the times"""
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
     t1 = [x.last_modified for x in Patch.objects.all()]
     run()
     t2 = [x.last_modified for x in Patch.objects.all()]
     for i in range(len(t1)):
         self.assertEqual(
             t1[i],
             t2[i])  #Running twice didn't change the last_modified times
Exemplo n.º 8
0
 def test_force(self):
     """Running force executes the patches even though they are in the database"""
     # First run once
     run()
     self.assertEqual(len(Species.objects.all()), 2)
     t1 = [x.last_modified for x in Patch.objects.all()]
     # Now remove records from the species database
     Species.objects.all().delete()
     # Now forcibly run again
     force()
     self.assertEqual(len(Species.objects.all()), 2)
     t2 = [x.last_modified for x in Patch.objects.all()]
     for i in range(len(t1)):
         self.assertNotEqual(t1[i], t2[i]) #Running force changed the modification times
Exemplo n.º 9
0
 def test_force(self):
     """Running force executes the patches even though they are in the database"""
     # First run once
     run()
     self.assertEqual(len(Species.objects.all()), 2)
     t1 = [x.last_modified for x in Patch.objects.all()]
     # Now remove records from the species database
     Species.objects.all().delete()
     # Now forcibly run again
     force()
     self.assertEqual(len(Species.objects.all()), 2)
     t2 = [x.last_modified for x in Patch.objects.all()]
     for i in range(len(t1)):
         self.assertNotEqual(
             t1[i], t2[i])  #Running force changed the modification times
Exemplo n.º 10
0
 def test_two_directories(self):
     """Patches with the same name should only be run once"""
     run() # Use value from settings
     run(directory='sql-patches')
     p = Species.objects.filter(genus = 'Eudynamys')
     print [str(x) for x in p]
Exemplo n.º 11
0
 def test_patches_run_in_list_order(self):
     """Test the patches are run in list order"""
     run()
     s = Species.objects.all()
     self.assertEqual(s[0].genus, 'Chrysococcyx')
     self.assertEqual(s[1].genus, 'Eudynamys')
Exemplo n.º 12
0
 def test_patch_executed(self):
     """Test the correct data has been inserted"""
     run()
     s = Species.objects.get(common_name='Shining bronze cuckoo')
     self.assertEqual(s.genus, 'Chrysococcyx')
Exemplo n.º 13
0
 def test_run_twice(self):
     """Test that running cuckoo twice only executes the patches once"""
     run()
     run()
     p = Patch.objects.all()
     self.assertEqual(len(p), 2)
Exemplo n.º 14
0
 def test_run(self):
     """Test that running cuckoo runs patches"""
     p = Patch.objects.all()
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
Exemplo n.º 15
0
 def test_run(self):
     """Test that running cuckoo runs patches"""
     p = Patch.objects.all()
     run()
     self.assertEqual(len(Patch.objects.all()), 2)
Exemplo n.º 16
0
 def test_patch_executed(self):
     """Test the correct data has been inserted"""
     run()
     s = Species.objects.get(common_name = 'Shining bronze cuckoo')
     self.assertEqual(s.genus, 'Chrysococcyx') 
Exemplo n.º 17
0
 def test_argument_directory(self):
     run(directory='sql-patches')
     p = Species.objects.get(genus='Eudynamys')
     self.assertEqual(p.species, 'taitensis')
Exemplo n.º 18
0
 def test_argument_directory(self):
     run(directory='sql-patches')
     p = Species.objects.get(genus = 'Eudynamys')
     self.assertEqual(p.species, 'taitensis')
Exemplo n.º 19
0
 def test_run_twice(self):
     """Test that running cuckoo twice only executes the patches once"""
     run()
     run()
     p = Patch.objects.all()
     self.assertEqual(len(p), 2)
Exemplo n.º 20
0
 def test_patches_run_in_list_order(self):
     """Test the patches are run in list order"""
     run()
     s = Species.objects.all()
     self.assertEqual(s[0].genus, 'Chrysococcyx') 
     self.assertEqual(s[1].genus, 'Eudynamys')
Exemplo n.º 21
0
 def test_settings_directory(self):
     run()
     p = Species.objects.get(genus='Eudynamys')
     self.assertEqual(p.species, 'orientalis')
Exemplo n.º 22
0
 def test_settings_directory(self):
     run()
     p = Species.objects.get(genus = 'Eudynamys')
     self.assertEqual(p.species, 'orientalis')