title: patching boto3.resource and resource.Table method for unit testing
body: <p>Here is my class:</p>
  
  <pre><code># Production.py
  import boto3
  
  
  class Production(object):
      resource = boto3.resource('dynamodb', 'us-west-2')
  
      def __init__(self):
          self.table = Production.resource.Table('employee')
  </code></pre>
  
  <p>I am trying to test that resource.Table is called with arg 'employee'. I wrote a unit test for it</p>
  
  <pre><code>def test_init():
     with patch('Production.boto3.resource') as resource:
         mock_resource = MagicMock()
         resource.return_value = mock_resource
         pd = Production()
         resource.assert_called_with('dynamodb', 'us-west-2')
         table = resource.return_value.Table.return_value
  
         table.assert_called_with('employee')
  
  
  test_init()
  </code></pre>
  
  <p>But it doesn't seem to work... Can some one help me how to test this?</p>