def setUp(self): user = StorageUser() user.email = '*****@*****.**' user.first_name = 'derek' user.last_name = 'shephard' user.set_password('password') user.save() self.user = user folder = Folder() folder.name = "test" folder.owner = user folder.save() self.folder = folder file = File() file.name = "boop.jpg" file.original_name = "boop.jpg" file.size = 123 file.mime_type = "img/jpg" file.folder = folder file.owner = user file.file = SimpleUploadedFile("file.jpg", b"file_content", content_type="image/jpeg") file.save() self.file = file
def setUp(self): user = StorageUser() user.email = '*****@*****.**' user.first_name = 'derek' user.last_name = 'shephard' user.set_password('password') user.save() self.user = user
def setUp(self): self.sample_time = models.DateTimeField(auto_now=True) test_user = StorageUser() test_user.first_name = 'John' test_user.last_name = 'Doe' test_user.email = '*****@*****.**' test_user.is_active = True test_user.is_superuser = False test_user.save() self.test_user = test_user self.test_file = SimpleUploadedFile("file.jpg", b"file_content", content_type="image/jpeg") test_folder = Folder() test_folder.name = 'home_folder' test_folder.owner = self.test_user test_folder.save() self.test_folder = test_folder
def setUp(self): user_1 = StorageUser() user_1.email = '*****@*****.**' user_1.first_name = 'derek' user_1.last_name = 'shephard' user_1.set_password('password') user_1.save() self.user_1 = user_1 user_2 = StorageUser() user_2.email = '*****@*****.**' user_2.first_name = 'richard' user_2.last_name = 'jones' user_2.set_password('password') user_2.save() self.user_2 = user_2 folder_root_1 = Folder() folder_root_1.name = 'user_1_root' folder_root_1.owner = user_1 folder_root_1.save() self.folder_root_1 = folder_root_1 folder_1 = Folder() folder_1.name = 'test_folder_1' folder_1.parent = folder_root_1 folder_1.owner = user_1 folder_1.save() self.folder_1 = folder_1 folder_2 = Folder() folder_2.name = 'test_folder_2' folder_2.owner = user_2 folder_2.save() self.folder_2 = folder_2
def test_user_root_folder_created_on_first_save(self): user = StorageUser() user.email = '*****@*****.**' user.first_name = 'derek' user.last_name = 'shephard' user.set_password('password') user.save() folder = Folder.objects.get(owner=user, parent=None) self.assertEqual(folder.name, 'root') user.save() self.assertEqual(Folder.objects.count(), 1)