def test_equality_operator(self):
     file_ = MockStorageFile(self.storage)
     file_.name = 'some_key'
     file2 = MockStorageFile(self.storage)
     file2.name = 'some_key'
     assert file_ == file2
     file2.rename('some other key')
     assert file_ != file2
 def test_equality_operator(self):
     file_ = MockStorageFile(self.storage)
     file_.name = 'some_key'
     file2 = MockStorageFile(self.storage)
     file2.name = 'some_key'
     assert file_ == file2
     file2.rename('some other key')
     assert file_ != file2
 def test_equality_operator_with_none_values(self):
     file_ = MockStorageFile(self.storage)
     file_.name = 'some_key'
     none = None
     assert not file_ == none
     assert file_ != none
 def test_supports_last_modified(self):
     file_ = MockStorageFile(self.storage, prefix=u'pics/')
     file_.name = 'some_key'
     file_.last_modified
 def test_supports_prefixes(self):
     file_ = MockStorageFile(self.storage, prefix='pics/')
     file_.name = 'some_key'
     assert file_.name == 'pics/some_key'
 def test_supports_save(self):
     file_ = MockStorageFile(self.storage)
     file_.name = 'some_key'
     file_.save(content='something')
     assert file_.read() == 'something'
 def test_rename_throws_error(self):
     storage = MockStorage('uploads')
     file_ = MockStorageFile(storage)
     file_.name = 'some_key'
     with raises(StorageException):
         file_.name = 'some_key2'
 def test_supports_name_attribute(self):
     storage = MockStorage('uploads')
     file_ = MockStorageFile(storage)
     file_.name = 'some_key'
     assert file_.name == 'some_key'
 def test_supports_file_objects_without_name(self):
     storage = MockStorage('uploads')
     file_ = MockStorageFile(storage)
     assert bool(file_) is False
 def test_equality_operator_with_none_values(self):
     file_ = MockStorageFile(self.storage)
     file_.name = 'some_key'
     none = None
     assert not file_ == none
     assert file_ != none
 def test_supports_last_modified(self):
     file_ = MockStorageFile(self.storage, prefix=u'pics/')
     file_.name = 'some_key'
     file_.last_modified
 def test_supports_prefixes(self):
     file_ = MockStorageFile(self.storage, prefix='pics/')
     file_.name = 'some_key'
     assert file_.name == 'pics/some_key'
 def test_supports_save(self):
     file_ = MockStorageFile(self.storage)
     file_.name = 'some_key'
     file_.save(content='something')
     assert file_.read() == 'something'
 def test_rename_throws_error(self):
     storage = MockStorage('uploads')
     file_ = MockStorageFile(storage)
     file_.name = 'some_key'
     with raises(StorageException):
         file_.name = 'some_key2'
 def test_supports_name_attribute(self):
     storage = MockStorage('uploads')
     file_ = MockStorageFile(storage)
     file_.name = 'some_key'
     assert file_.name == 'some_key'