Skip to content

test#3

Open
iFunnyMan520 wants to merge 4 commits intomasterfrom
feature/db_design
Open

test#3
iFunnyMan520 wants to merge 4 commits intomasterfrom
feature/db_design

Conversation

@iFunnyMan520
Copy link

No description provided.

db: str,
revs: bool = None,
docs: dict = None) -> types.UniversalResponse:
docs: typing.List[models.Doc],
Copy link
Owner

Choose a reason for hiding this comment

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

нужно внимательно смотреть, какие из параметров являются обязательными


if docs:
json_data['docs'] = f'{docs}'
json_data['docs'] = [item.dump() for item in docs]
Copy link
Owner

Choose a reason for hiding this comment

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

неправильное обьявление json-данных

async def db_bulk_docs(self,
db: str,
docs: list = None,
docs: typing.List[models.ExtendedDoc],
Copy link
Owner

Choose a reason for hiding this comment

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

нужно сделать нормальные модели для запросов, если речь идет о POST-запросе

404: 'Requested database not found'
},
query=query,
json_data=json_data,
Copy link
Owner

Choose a reason for hiding this comment

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

тут вообще поле передачи данных было пропущено

Comment on lines +39 to +51
class Doc:
id: str
rev: str = None

def dump(self):
return {'id': self.id, 'rev': self.rev}


@dataclass()
class ExtendedDoc:
_id: str
_rev: str = None
_deleted: bool = None
Copy link
Owner

Choose a reason for hiding this comment

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

вот так надо было сделать для этих POST-запросов модели. Еще надо найти готовые или создать ответы для этих же запросов


def test_design_docs(async_run: Callable, client: CouchClient):
# todo: type of keys is invalid
response = async_run(client.db_design_docs(db_name, keys=[doc_id]))
Copy link
Owner

Choose a reason for hiding this comment

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

тут неправильный тип данных передавался - список против словаря

Comment on lines 62 to 71
def __test_bulk_get(async_run: Callable, client: CouchClient):
docs = [db_models.Doc(id=doc_id)]
response = async_run(client.db_bulk_get(db_name, docs=docs))
assert response.status_code == 200


#def test_bulk_docs(async_run: Callable, client: CouchClient):
#response = async_run(client.db_bulk_docs(db_name, docs=[doc_id]))
#assert response.status_code == 200
def test_bulk_docs(async_run: Callable, client: CouchClient):
docs = [db_models.ExtendedDoc(_id=doc_id)]
response = async_run(client.db_bulk_docs(db_name, docs=docs))
assert response.status_code == 200
Copy link
Owner

Choose a reason for hiding this comment

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

эти тесты дальше правь сам

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants