Skip to content

Instantly share code, notes, and snippets.

View pimiento's full-sized avatar

Pavel pimiento

View GitHub Profile
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.1.3, pluggy-1.2.0 -- /home/pimiento/yap/gulnaz-django-sprint3/venv/bin/python3.10
django: settings: blogicum.settings (from ini)
rootdir: /home/pimiento/yap/gulnaz-django-sprint3, configfile: pytest.ini, testpaths: tests/
plugins: Faker-12.0.1, django-4.5.2
collecting ... collected 82 items
tests/test_category_page_views.py::test_category_page ERROR [ 1%]
tests/test_category_page_views.py::test_category_page_check_context_keys[title] ERROR [ 2%]
tests/test_category_page_views.py::test_category_page_check_context_keys[key1] ERROR [ 3%]
$ python manage.py loaddata db.json
Traceback (most recent call last):
File "/home/pimiento/yap/redkina-django-sprint3/venv/lib/python3.10/site-packages/django/db/models/options.py", line 608, in get_field
return self.fields_map[field_name]
KeyError: 'location'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pimiento/yap/redkina-django-sprint3/venv/lib/python3.10/site-packages/django/core/serializers/json.py", line 70, in Deserializer
============================= test session starts ==============================
platform linux -- Python 3.10.11, pytest-7.1.3, pluggy-1.0.0 -- /home/pimiento/yap/peschanov-django-sprint4/venv/bin/python3.10
django: settings: blogicum.settings (from ini)
rootdir: /home/pimiento/yap/peschanov-django-sprint4, configfile: pytest.ini
plugins: Faker-12.0.1, django-4.5.2
collecting ... collected 5 items
tests/test_content.py::TestContent::test_unpublished FAILED [ 20%]
tests/test_content.py::TestContent::test_unpublished_category FAILED [ 40%]
tests/test_content.py::TestContent::test_future_posts FAILED [ 60%]
from django.contrib.auth import get_user_model
from django.db import models
from django.urls import reverse
from django.utils import timezone
User = get_user_model()
class BaseModel(models.Model):
is_published = models.BooleanField(
@pimiento
pimiento / foo.py
Created April 25, 2023 07:18
это публичный gist
print("HELLO WORLD")
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#
-i https://pypi.org/simple
aiosqlite==0.17.0
alembic==1.7.7
#!/usr/bin/env bash
# https://www.crunchydata.com/blog/ssl-certificate-authentication-postgresql-docker-containers
HOST=${1:-localhost}
USERNAME=${2:-external_user}
mkdir keys certs
chmod og-rwx keys certs
openssl req -new -x509 -days 365 -nodes -out certs/ca.crt -keyout keys/ca.key -subj "/CN=root-ca"
# Comment it before submitting
class Node:
def __init__(self, value: str, next_item: Optional[Node] = None):
self.value: str = value
self.next_item: Node = next_item
def solution(node: Node, idx: int) -> Node:
def get_node_by_index(node: Node, index) -> Node:
...
import functools
class CountCalls:
def __init__(self, x):
self.x = x
def __call__(self, func):
functools.update_wrapper(self, func)
self.func = func
self.num_calls = 0
++ jq -r '.["rabota.ru"]["access_token"]'
+ TOKEN=igGJsM7DJuLTnRiDPk87cqi2bfanhs6i
+ SECRET=2GT4JbcP7CmDkwKShkLZPm1uAZMLS6Nw
+ APP_ID=517
++ date +%s
+ params='{"app_id":"517","time":"1678354730","token":"igGJsM7DJuLTnRiDPk87cqi2bfanhs6i"}'
++ echo -n '{"app_id":"517","time":"1678354730","token":"igGJsM7DJuLTnRiDPk87cqi2bfanhs6i"}2GT4JbcP7CmDkwKShkLZPm1uAZMLS6Nw'
++ sha256sum
++ cut -d ' ' -f 1
+ signature=1b644fc8ed3692822b2590ae9a533f063340ee1b736f6e66da03311a9d6ff960