File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -368,20 +368,24 @@ A common use case is when we have to assert the outcome of an HTTP request:
368
368
369
369
from pytest_bdd import scenarios, given, when, then
370
370
371
+ from my_app.models import Article
372
+
371
373
scenarios(" blog.feature" )
372
374
375
+
373
376
@given (" there is an article" , target_fixture = " article" )
374
377
def there_is_an_article ():
375
378
return Article()
376
379
380
+
377
381
@when (" I request the deletion of the article" , target_fixture = " request_result" )
378
- def there_should_be_a_new_article (article , http_client ): # <-- Important bit here
382
+ def there_should_be_a_new_article (article , http_client ):
379
383
return http_client.delete(f " /articles/ { article.uid} " )
380
384
385
+
381
386
@then (" the request should be successful" )
382
387
def article_is_published (request_result ):
383
- assert request_result.status_code = 200
384
-
388
+ assert request_result.status_code == 200
385
389
386
390
387
391
.. code-block :: gherkin
You can’t perform that action at this time.
0 commit comments