title: Python: Mocking DateTime Issues
body: <p>Here is my Python method:</p>
  
  <pre><code>for time in (timedelta(hours=3), timedelta(minutes=30)):
  
      delay = (datetime.now() + time).strftime('%Y-%m-%dT%H:%M:%S')
      payload = json.dumps({
          "channels": [
              "accountID-{acct_id}".format(acct_id=account_id)
          ],
          "push_time": delay,
          "data": {
              "alert": "Test Push",
              "m": "12345"
          },
      })
  
      try:
          requests.post(
              "https://api.parse.com/1/push",
              data=payload,
              headers={
                  "X-Parse-Application-Id": settings.PARSE_APPLICATION_ID,
                  "X-Parse-REST-API-Key": settings.PARSE_REST_API_KEY,
                  "Content-Type": "application/json"
              }
          )
      except requests.exceptions.RequestException as e:
          logging.getLogger().setLevel(logging.ERROR)
  </code></pre>
  
  <p>Here is my test:</p>
  
  <pre><code>@patch("requests.post")
  def test_send_push_notifications_to_parse(self, post_mock):
      post_mock.return_value = {"status": 200}
      mailing = Mock()
      mailing.name = "Foo Name"
      mailing.account_id = 12345
      mailing.mailing_id = 45
  
      payload = json.dumps({
          "channels": [
              "accountID-12345"
          ],
          "push_time": "2014-03-04T15:00:00",
          "data": {
              "alert": "Test Push",
              "m": "12345"
          },
      })
  
      send_push_notification_to_parse(mailing.account_id, mailing.mailing_id, mailing.name)
  
      post_mock.assert_called_with(
          "https://api.parse.com/1/push",
          data=payload,
          headers={
              "X-Parse-Application-Id": settings.PARSE_APPLICATION_ID,
              "X-Parse-REST-API-Key": settings.PARSE_REST_API_KEY,
              "Content-Type": "application/json"
          }
      )
  </code></pre>
  
  <p>The test fails because the POST request is inside of a loop where the <code>datetime</code>object changes. How can I patch the <code>datetime</code> object to make my test pass? </p>