def test_labbook_content_size_simply(self, mock_labbook): x, y, lb = mock_labbook lb_size = FO.content_size(lb) # Make sure the new LB is about 10-30kB. This is about reasonable for a new, emtpy LB. assert lb_size > 10000 assert lb_size < 30000
def resolve_size_bytes(self, info): """Return the size of the labbook on disk (in bytes). NOTE! This must be a string, as graphene can't quite handle big integers. """ return info.context.labbook_loader.load( f"{get_logged_in_username()}&{self.owner}&{self.name}").then( lambda labbook: str(FileOperations.content_size(labbook)))