Allow timestamp to be set for comment models in test cases

Review Request #12394 — Created June 21, 2022 and submitted

Information

Review Board
release-5.0.x

Reviewers

The create methods for comments in reviewboard.testing.TestCase does not
properly set the timestamp when a timestamp argument is passed. This is
because the timestamp is being overriden when when the comment object is saved.
This change allows reviewboard.testing.TestCase to properly set the timestamp
when a timestamp argument is passed.

Ran all unit tests in reviewboard.webapi.tests, which make use of the create
comment methods.

Summary ID
Allow timestamp to be set for comment models in test cases
8c3938b660d46ba386be3be8fd4d269686b4f826
Description From Last Updated

Can you add a Version Added? I know technically this was available to be passed in **kwargs, but clearly that …

chipx86chipx86

Our chaining-based formatting doesn't work super well for things like updates. For things like this, I generally recommend: queryset = …

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/testing/testcase.py (Diff revision 1)
     
     
     
    Show all issues

    Can you add a Version Added?

    I know technically this was available to be passed in **kwargs, but clearly that didn't work.

    Same below.

  3. reviewboard/testing/testcase.py (Diff revision 1)
     
     
     
     
    Show all issues

    Our chaining-based formatting doesn't work super well for things like updates.

    For things like this, I generally recommend:

    queryset = FileAttachmentComment.objects.filter(...)
    queryset.update(...)
    

    Helps distinguish the query from the operation, when it has to span lines. Of course, the query can be chained as needed.

    Same below.

  4. 
      
maubin
david
  1. Ship It!
  2. 
      
chipx86
  1. Ship It!
  2. 
      
maubin
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (f2ee7e0)
Loading...