Skip to content

Commit

Permalink
Change to a boolean field
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkaMaul committed Dec 10, 2024
1 parent 60f4a01 commit 60de6e8
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 108 deletions.
3 changes: 0 additions & 3 deletions tests/common/db/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ class Meta:

uploader = factory.SubFactory(UserFactory)
description = factory.SubFactory(DescriptionFactory)
published = factory.Faker(
"date_time_between_dates", datetime_start=datetime.datetime(2008, 1, 1)
)


class FileFactory(WarehouseFactory):
Expand Down
1 change: 1 addition & 0 deletions tests/unit/forklift/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3613,6 +3613,7 @@ def test_upload_succeeds_creates_release(
else None
),
"uploaded_via_trusted_publisher": not test_with_user,
"published": True,
}

fileadd_event = {
Expand Down
8 changes: 1 addition & 7 deletions tests/unit/packaging/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from datetime import datetime

import pretend
import pytest
Expand Down Expand Up @@ -326,12 +325,7 @@ def test_long_singleline_license(self, db_request):

def test_created_with_published(self, db_request):
release = ReleaseFactory.create()
assert release.published > datetime(year=2008, month=1, day=1)

def test_without_published_date(self, db_request):
release = ReleaseFactory.create(published=None)
db_request.db.flush()
assert release.published is None
assert release.published is True


class TestReportMalwareButton:
Expand Down
3 changes: 1 addition & 2 deletions warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import zipfile

from cgi import FieldStorage
from datetime import datetime

import packaging.requirements
import packaging.specifiers
Expand Down Expand Up @@ -903,7 +902,6 @@ def file_upload(request):
},
uploader=request.user if request.user else None,
uploaded_via=request.user_agent,
published=datetime.now(),
)
request.db.add(release)
is_new_release = True
Expand Down Expand Up @@ -934,6 +932,7 @@ def file_upload(request):
else None
),
"uploaded_via_trusted_publisher": bool(request.oidc_publisher),
"published": True,
},
)

Expand Down
Loading

0 comments on commit 60de6e8

Please sign in to comment.