Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Simple TestCase assertion that finds element based on it's path and check if it equals with given content.
.. image:: https://badge.fury.io/py/assert_element.svg :target: https://badge.fury.io/py/assert_element
.. image:: https://codecov.io/gh/PetrDlouhy/assert_element/branch/master/graph/badge.svg :target: https://codecov.io/gh/PetrDlouhy/assert_element
.. image:: https://github.com/PetrDlouhy/django-assert-element/actions/workflows/main.yml/badge.svg?event=registry_package :target: https://github.com/PetrDlouhy/django-assert-element/actions/workflows/main.yml
Simple TestCase assertion that finds element based on it's path and check if it equals with given content.
This is more useful than the default Django AssertContains because it will find the element and show differences if something changed. The test also tries to ignore differences in whitespaces as much as possible.
I released this package just to realize after few days, that there are some other very similar projects:
The full documentation is at https://assert_element.readthedocs.io.
Install by:
.. code-block:: bash
pip install assert-element
Usage in tests:
.. code-block:: python
from assert_element import AssertElementMixin
class MyTestCase(AssertElementMixin, TestCase):
def test_something(self):
response = self.client.get(address)
self.assertElementContains(
response,
'div[id="my-div"]',
'<div id="my-div">My div</div>',
)
The first attribute can be response or content itself. Second attribute is the path to the element. Third attribute is the expected content.
Does the code actually work?
::
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox
::
pip install -r requirements_dev.txt
invoke -l
Tools used in rendering this package:
cookiecutter-djangopackage
_.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _cookiecutter-djangopackage
: https://github.com/pydanny/cookiecutter-djangopackage
0.4.0 (2023-07-21) ++++++++++++++++++
0.3.0 (2022-09-16) ++++++++++++++++++
0.2.0 (2022-09-01) ++++++++++++++++++
0.1.0 (2022-08-21) ++++++++++++++++++
FAQs
Simple TestCase assertion that finds element based on it's path and check if it equals with given content.
We found that assert-element demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.