Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
nsyed22 committed Jan 2, 2025
1 parent c719113 commit fd2a720
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions test/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -10295,7 +10295,6 @@ def test_gold_annotations_regular_admin_subadmin_users(self):
res = self.app_get_json(f"/api/project/{project.id}/gold_annotations")
assert res.status_code == 200, data

class TestChecksum(web.Helper):
@with_context
@patch("pybossa.task_creator_helper.get_encryption_key")
@patch("pybossa.task_creator_helper.read_encrypted_file")
Expand Down Expand Up @@ -10362,45 +10361,6 @@ def test_generate_checksum_missing_project(self, mock_project):
checksum = generate_checksum(project=None, task=task)
assert not checksum

@with_context
def test_generate_checksum_private_data(self):
"""Test checksum is generated for private data"""
from flask import current_app

current_app.config["PRIVATE_INSTANCE"] = True
current_app.config["TASK_REQUIRED_FIELDS"] = {
'b': {'val': None, 'check_val': False, 'require_int': True},
}
checksum = hashlib.sha256()
expected_dupcheck_payload = {"a": 1, "c": 3}
checksum.update(json.dumps(expected_dupcheck_payload, sort_keys=True).encode("utf-8"))
expected_checksum = checksum.hexdigest()

subadmin = UserFactory.create(subadmin=True)
self.signin_user(subadmin)
project = ProjectFactory.create(
owner=subadmin,
short_name="testproject",
info={
"duplicate_task_check": {
"duplicate_fields": ["a", "b", "c"]
}
})

task = TaskFactory.create(
project=project,
info={"a": 1, "b": 2, "c": 3},
dup_checksum=expected_checksum
)
# confirm task payload populated with checksum generated
assert task.dup_checksum == expected_checksum, task.dup_checksum

# project w/o duplicate checksum configured gets
# tasks created with null checksum value
project2 = ProjectFactory.create(owner=subadmin, info={"x": 123}, short_name="xyz")
task2 = TaskFactory.create(project=project2, info={"a": 1, "b": 2, "c": 3})
assert task2.dup_checksum == None

@with_context
def test_generate_checksum_public_data(self):
"""Test checksum is generated for public data"""
Expand All @@ -10419,7 +10379,7 @@ def test_generate_checksum_public_data(self):
short_name="testproject",
info={
"duplicate_task_check": {
"duplicate_fields": ["a", "b", "c"]
"duplicate_fields": ["a", "c"]
}
})

Expand Down

0 comments on commit fd2a720

Please sign in to comment.