• 
      

    Fix issues caused by HttpRequest API change in Python 3

    Review Request #10922 — Created Feb. 26, 2020 and submitted

    Information

    rbintegrations
    master
    79c65a2...

    Reviewers

    Python 3's urllib changed the request object so that instead of having a
    get_data method, there's now just a data attribute. It turns out
    that this attribute also existed in Python 2, although it wasn't the
    official API. This change modifies the idonethis tests to use that
    everywhere.

    Ran rbintegrations unit tests.

    Description From Last Updated

    get_data() has been useless forever. It's literally just defined as return self.data, and we use .data pretty much everywhere else. …

    chipx86chipx86

    json.loads() expects a Unicode string, but request.data should be bytes. Looks like this would apply to others. Can you verify …

    chipx86chipx86

    Wanna change this to assertIsNone?

    chipx86chipx86

    And here?

    chipx86chipx86
    chipx86
    1. 
        
    2. Show all issues

      get_data() has been useless forever. It's literally just defined as return self.data, and we use .data pretty much everywhere else. Let's just move to that directly.

    3. 
        
    david
    chipx86
    1. 
        
    2. rbintegrations/idonethis/tests.py (Diff revision 2)
       
       
      Show all issues

      json.loads() expects a Unicode string, but request.data should be bytes.

      Looks like this would apply to others. Can you verify Python 3 tests are working here?

      1. So we weren't encoding to bytes before setting Request.data (which I'll fix), but json.loads() works on both str and bytes in Python 2 and 3.

      2. Just confirmed that it's Python 3.5 that doesn't support it. Python 3.6+ will decode.

    3. rbintegrations/idonethis/tests.py (Diff revision 2)
       
       
      Show all issues

      Wanna change this to assertIsNone?

    4. rbintegrations/idonethis/tests.py (Diff revision 2)
       
       
      Show all issues

      And here?

    5. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (4a77e38)