Coder Social home page Coder Social logo

Comments (2)

spulec avatar spulec commented on July 17, 2024

Thanks for the report. This should be fixed with #54.

from moto.

Zulunko avatar Zulunko commented on July 17, 2024

Can someone confirm that this was actually fixed? My tests for this and issue #60 both seem to still fail. This is the exact code I'm running to test these issues:

import unittest
from moto import mock_s3
import boto
from boto.s3.key import Key

class TestMoto(unittest.TestCase):

    @mock_s3
    def test_get_key_size(self):
        conn = boto.connect_s3('the_key', 'the_secret')
        b = conn.create_bucket('test')
        k = Key(b, 'hi')
        k.set_contents_from_string('hello')
        self.assertEqual(k.size, 5) # Succeeds
        self.assertEqual(b.get_key('hi').size, 5) # Fails

    @mock_s3
    def test_key_size(self):
        conn = boto.connect_s3('the_key', 'the_secret')
        b = conn.create_bucket('test')
        k = Key(b, 'hi')
        k.set_contents_from_string('hello')
        self.assertEqual(k.size, 5) # Succeeds
        k2 = Key(b, 'hi')
        self.assertEqual(k2.size, 5) # Fails

if __name__=='__main__':
    unittest.main()

I believe I'm running moto version 0.2.15 now and this should have been fixed by 0.2.10, but perhaps I'm mistaken.

from moto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.