Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert some tests to pytest #1693

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change test_url_md5_hash
ZeyadTarekk committed Nov 8, 2024
commit 485f8f7d02284f65cb888d93f6db8880f2b59075
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.

import unittest

import pytest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file looks good

from threatexchange.signal_type.url_md5 import UrlMD5Signal

URL_TEST = "www.facebook.com/?user=123"
FULL_URL_TEST = "https://www.facebook.com/?user=123"
URL_TEST_MD5 = "e359430911fe80c2dd526d3cca21da30"

def test_can_hash_simple_url():
assert UrlMD5Signal.hash_from_str(URL_TEST) == URL_TEST_MD5, "MD5 hash does not match"

class UrlMD5SignalTestCase(unittest.TestCase):
def test_can_hash_simple_url(self):
assert URL_TEST_MD5 == UrlMD5Signal.hash_from_str(
URL_TEST
), "MD5 hash does not match"

def test_can_hash_full_url(self):
assert URL_TEST_MD5 == UrlMD5Signal.hash_from_str(
FULL_URL_TEST
), "MD5 hash does not match"
def test_can_hash_full_url():
assert UrlMD5Signal.hash_from_str(FULL_URL_TEST) == URL_TEST_MD5, "MD5 hash does not match"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: The existing asset comments don't seem to add much, but I think it's fine to ignore