Ejemplo n.º 1
0
 def test_update_commit(self):
     test_dir = os.path.join(base_dir, 'files')
     self.assertEqual(ImportedFile.objects.count(), 0)
     _manage_imported_files(self.version, test_dir, 'commit01')
     self.assertEqual(ImportedFile.objects.first().commit, 'commit01')
     _manage_imported_files(self.version, test_dir, 'commit02')
     self.assertEqual(ImportedFile.objects.first().commit, 'commit02')
Ejemplo n.º 2
0
 def test_properly_created(self):
     test_dir = os.path.join(base_dir, 'files')
     self.assertEqual(ImportedFile.objects.count(), 0)
     _manage_imported_files(self.version, test_dir, 'commit01')
     self.assertEqual(ImportedFile.objects.count(), 2)
     _manage_imported_files(self.version, test_dir, 'commit01')
     self.assertEqual(ImportedFile.objects.count(), 2)
Ejemplo n.º 3
0
 def test_update_commit(self):
     test_dir = os.path.join(base_dir, 'files')
     self.assertEqual(ImportedFile.objects.count(), 0)
     _manage_imported_files(self.version, test_dir, 'commit01', 1)
     self.assertEqual(ImportedFile.objects.first().commit, 'commit01')
     _manage_imported_files(self.version, test_dir, 'commit02', 2)
     self.assertEqual(ImportedFile.objects.first().commit, 'commit02')
Ejemplo n.º 4
0
 def test_properly_created(self):
     test_dir = os.path.join(base_dir, 'files')
     self.assertEqual(ImportedFile.objects.count(), 0)
     _manage_imported_files(self.version, test_dir, 'commit01', 1)
     self.assertEqual(ImportedFile.objects.count(), 3)
     _manage_imported_files(self.version, test_dir, 'commit01', 2)
     self.assertEqual(ImportedFile.objects.count(), 3)
Ejemplo n.º 5
0
    def test_update_content(self):
        test_dir = os.path.join(base_dir, 'files')
        self.assertEqual(ImportedFile.objects.count(), 0)

        with open(os.path.join(test_dir, 'test.html'), 'w+') as f:
            f.write('Woo')

        _manage_imported_files(self.version, test_dir, 'commit01')
        self.assertEqual(ImportedFile.objects.get(name='test.html').md5, 'c7532f22a052d716f7b2310fb52ad981')

        with open(os.path.join(test_dir, 'test.html'), 'w+') as f:
            f.write('Something Else')

        _manage_imported_files(self.version, test_dir, 'commit02')
        self.assertNotEqual(ImportedFile.objects.get(name='test.html').md5, 'c7532f22a052d716f7b2310fb52ad981')

        self.assertEqual(ImportedFile.objects.count(), 2)
Ejemplo n.º 6
0
    def test_update_content(self):
        test_dir = os.path.join(base_dir, 'files')
        self.assertEqual(ImportedFile.objects.count(), 0)

        with open(os.path.join(test_dir, 'test.html'), 'w+') as f:
            f.write('Woo')

        _manage_imported_files(self.version, test_dir, 'commit01')
        self.assertEqual(ImportedFile.objects.get(name='test.html').md5, 'c7532f22a052d716f7b2310fb52ad981')

        with open(os.path.join(test_dir, 'test.html'), 'w+') as f:
            f.write('Something Else')

        _manage_imported_files(self.version, test_dir, 'commit02')
        self.assertNotEqual(ImportedFile.objects.get(name='test.html').md5, 'c7532f22a052d716f7b2310fb52ad981')

        self.assertEqual(ImportedFile.objects.count(), 3)