Beispiel #1
0
 def test_export(self):
     home = 'dflat-test'
     dflat.init(home)
     # create v002
     dflat.checkout(home)
     with open('dflat-test/v002/full/producer/reddspec.html', 'a') as f1:
         f1.write('mod')
     # commit v002
     dflat.commit(home)
     # create v003
     dflat.checkout(home)
     with open('dflat-test/v003/full/producer/new file.txt', 'w') as f2:
         f2.write('new file')
     # commit v003
     dflat.commit(home)
     # create v004
     dflat.checkout(home)
     remove('dflat-test/v004/full/producer/dflatspec.pdf')
     # commit v004
     dflat.commit(home)
     # create v005
     dflat.checkout(home)
     # commit v005
     dflat.commit(home)
     # export an invalid version
     self.assertRaises(Exception, dflat.export, home, 'v000') 
     # export v004 and check it
     dflat.export(home, "v004")
     self.assertTrue(isdir('dflat-test/export-v004'))
     self.assertFalse(isfile('dflat-test/export-v004/full/producer/dflatspec.pdf'))
     with open('dflat-test/export-v004/full/producer/reddspec.html') as f3:
         with open('dflat-test/v005/full/producer/reddspec.html') as f4:
             self.assertEqual(f3.read(), f4.read())
     # export v003 and check it
     dflat.export(home, "v003")
     self.assertTrue(isdir('dflat-test/export-v003'))
     self.assertTrue(isfile('dflat-test/export-v003/full/producer/new file.txt'))
     self.assertTrue(isfile('dflat-test/export-v003/full/producer/dflatspec.pdf'))
     with open('dflat-test/export-v003/full/producer/reddspec.html') as f5:
         with open('dflat-test/v005/full/producer/reddspec.html') as f6:
             self.assertEqual(f5.read(), f6.read())
     # export v002 and check it
     dflat.export(home, "v002")
     self.assertTrue(isdir('dflat-test/export-v002'))
     self.assertFalse(isfile('dflat-test/export-v002/full/producer/new file.txt'))
     self.assertTrue(isfile('dflat-test/export-v002/full/producer/dflatspec.pdf'))
     self.assertFileEqual('dflat-test/export-v002/full/producer/reddspec.html',
                          'dflat-test/v005/full/producer/reddspec.html')
     # export v001 and check it
     dflat.export(home, "v001")
     self.assertTrue(isdir('dflat-test/export-v001'))
     self.assertFalse(isfile('dflat-test/export-v001/full/producer/new file.txt'))
     self.assertTrue(isfile('dflat-test/export-v001/full/producer/dflatspec.pdf'))
     with open('dflat-test/export-v001/full/producer/reddspec.html') as f7:
         with open('dflat-test/v005/full/producer/reddspec.html') as f8:
             self.assertNotEqual(f7.read(), f8.read())
Beispiel #2
0
 def test_export(self):
     home = 'dflat-test'
     dflat.init(home)
     # create v002
     dflat.checkout(home)
     open('dflat-test/v002/full/data/reddspec.html', 'a').write('mod')
     # commit v002
     dflat.commit(home)
     # create v003
     dflat.checkout(home)
     open('dflat-test/v003/full/data/new file.txt', 'w').write('new file')
     # commit v003
     dflat.commit(home)
     # create v004
     dflat.checkout(home)
     remove('dflat-test/v004/full/data/dflatspec.pdf')
     # commit v004
     dflat.commit(home)
     # create v005
     dflat.checkout(home)
     # commit v005
     dflat.commit(home)
     # export an invalid version
     self.assertRaises(Exception, dflat.export, home, 'v000') 
     # export v004 and check it
     dflat.export(home, "v004")
     self.assertTrue(isdir('dflat-test/export-v004'))
     self.assertFalse(isfile('dflat-test/export-v004/full/data/dflatspec.pdf'))
     self.assertEqual(open('dflat-test/export-v004/full/data/reddspec.html').read(), 
                      open('dflat-test/v005/full/data/reddspec.html').read())
     # export v003 and check it
     dflat.export(home, "v003")
     self.assertTrue(isdir('dflat-test/export-v003'))
     self.assertTrue(isfile('dflat-test/export-v003/full/data/new file.txt'))
     self.assertTrue(isfile('dflat-test/export-v003/full/data/dflatspec.pdf'))
     self.assertEqual(open('dflat-test/export-v003/full/data/reddspec.html').read(), 
                      open('dflat-test/v005/full/data/reddspec.html').read())
     # export v002 and check it
     dflat.export(home, "v002")
     self.assertTrue(isdir('dflat-test/export-v002'))
     self.assertFalse(isfile('dflat-test/export-v002/full/data/new file.txt'))
     self.assertTrue(isfile('dflat-test/export-v002/full/data/dflatspec.pdf'))
     self.assertFileEqual('dflat-test/export-v002/full/data/reddspec.html',
                          'dflat-test/v005/full/data/reddspec.html')
     # export v001 and check it
     dflat.export(home, "v001")
     self.assertTrue(isdir('dflat-test/export-v001'))
     self.assertFalse(isfile('dflat-test/export-v001/full/data/new file.txt'))
     self.assertTrue(isfile('dflat-test/export-v001/full/data/dflatspec.pdf'))
     self.assertNotEqual(open('dflat-test/export-v001/full/data/reddspec.html').read(), 
                      open('dflat-test/v005/full/data/reddspec.html').read())
Beispiel #3
0
 def test_export(self):
     home = 'dflat-test'
     dflat.init(home)
     # create v002
     dflat.checkout(home)
     with open('dflat-test/v002/full/producer/reddspec.html', 'a') as f1:
         f1.write('mod')
     # commit v002
     dflat.commit(home)
     # create v003
     dflat.checkout(home)
     with open('dflat-test/v003/full/producer/new file.txt', 'w') as f2:
         f2.write('new file')
     # commit v003
     dflat.commit(home)
     # create v004
     dflat.checkout(home)
     remove('dflat-test/v004/full/producer/dflatspec.pdf')
     # commit v004
     dflat.commit(home)
     # create v005
     dflat.checkout(home)
     # commit v005
     dflat.commit(home)
     # export an invalid version
     self.assertRaises(Exception, dflat.export, home, 'v000')
     # export v004 and check it
     dflat.export(home, "v004")
     self.assertTrue(isdir('dflat-test/export-v004'))
     self.assertFalse(
         isfile('dflat-test/export-v004/full/producer/dflatspec.pdf'))
     with open('dflat-test/export-v004/full/producer/reddspec.html') as f3:
         with open('dflat-test/v005/full/producer/reddspec.html') as f4:
             self.assertEqual(f3.read(), f4.read())
     # export v003 and check it
     dflat.export(home, "v003")
     self.assertTrue(isdir('dflat-test/export-v003'))
     self.assertTrue(
         isfile('dflat-test/export-v003/full/producer/new file.txt'))
     self.assertTrue(
         isfile('dflat-test/export-v003/full/producer/dflatspec.pdf'))
     with open('dflat-test/export-v003/full/producer/reddspec.html') as f5:
         with open('dflat-test/v005/full/producer/reddspec.html') as f6:
             self.assertEqual(f5.read(), f6.read())
     # export v002 and check it
     dflat.export(home, "v002")
     self.assertTrue(isdir('dflat-test/export-v002'))
     self.assertFalse(
         isfile('dflat-test/export-v002/full/producer/new file.txt'))
     self.assertTrue(
         isfile('dflat-test/export-v002/full/producer/dflatspec.pdf'))
     self.assertFileEqual(
         'dflat-test/export-v002/full/producer/reddspec.html',
         'dflat-test/v005/full/producer/reddspec.html')
     # export v001 and check it
     dflat.export(home, "v001")
     self.assertTrue(isdir('dflat-test/export-v001'))
     self.assertFalse(
         isfile('dflat-test/export-v001/full/producer/new file.txt'))
     self.assertTrue(
         isfile('dflat-test/export-v001/full/producer/dflatspec.pdf'))
     with open('dflat-test/export-v001/full/producer/reddspec.html') as f7:
         with open('dflat-test/v005/full/producer/reddspec.html') as f8:
             self.assertNotEqual(f7.read(), f8.read())