From 7f80588f5fad4f1bad0ce651ae2ad9bba7b5d588 Mon Sep 17 00:00:00 2001 From: Camila Maia Date: Thu, 27 May 2021 16:49:45 -0300 Subject: [PATCH 01/11] Remove Spectrum Badge from README.md (#381) --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2b56e3f..24534523 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,6 @@ PyPI version - - Join the community on Spectrum -

A library for **your API** that provides: @@ -92,9 +89,11 @@ Then, the lib will hit the specified endpoints and generate a `scanapi-report.ht

## Documentation + The full documentation is available at [scanapi.dev][website] ## Examples + You can find complete examples at [scanapi/examples][scanapi-examples]! This tutorial helps you to create integration tests for your REST API using ScanAPI From e059845eb01d04e681a3cafe1dcbd3e5158bfceb Mon Sep 17 00:00:00 2001 From: Pradhvan Bisht Date: Thu, 3 Jun 2021 00:38:32 +0530 Subject: [PATCH 02/11] Add issue template (#385) * Added three templates for bug_report, feature_request and how to question. Closes https://github.com/scanapi/scanapi/issues/382 --- .github/ISSUE_TEMPLATE/bug_report.md | 25 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 18 ++++++++++++++++ .github/ISSUE_TEMPLATE/how_to_question.md | 22 ++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/how_to_question.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..d8b16c29 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: Bug report +about: 🐛 Create a a bug report. +labels: bug, needs triage +assignees: + +--- + +## Bug report + +### Environment +- Operating System: +- Python version: + +### Description of the bug + + +### Expected behavior ? + + +### How to reproduce the the bug ? + + +### Anthing else we need to know? + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..c3b66a05 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,18 @@ +--- +name: Feature request +about: 🌟 Submit a feature request. +labels: enhancement, needs triage +assignees: + +--- + +## Feature request + +### Description the feature + + +### Is your feature request related to a problem? + + +### Do you have any suggestions on how to add this feature in scanapi ? + diff --git a/.github/ISSUE_TEMPLATE/how_to_question.md b/.github/ISSUE_TEMPLATE/how_to_question.md new file mode 100644 index 00000000..d2bc3dd8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/how_to_question.md @@ -0,0 +1,22 @@ +--- +name: Question +about: ❓ How to questions with scanapi +labels: question, support +assignees: + +--- + +### Environment +- Operating System: +- Python version: + +### What you intend to do with scanapi ? + + +### Expected behavior ? + + + +--- + +scanapi has a [discord server](https://discord.gg/f3cCXJ2ZPB) so feel free to join and say 👋 hello. Maybe share the issue link? \ No newline at end of file From ce9e036b66cb596a8e9e22ef66c2be53540053a8 Mon Sep 17 00:00:00 2001 From: Pradhvan Bisht Date: Thu, 3 Jun 2021 18:35:45 +0530 Subject: [PATCH 03/11] Add PR template (#387) * Added PR template with a checklist for the author. * Added instructions in the checklists that points to the wiki. * Added a heading to reference PR template to related issue it closes. Closes: https://github.com/scanapi/scanapi/pull/383 --- .../pull_request_template.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 00000000..85406411 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,23 @@ +## Description + + +## Motivation behind this PR? + + +## What type of change is this? + + +## Checklist + + +- [ ] I have added a changelog entry / my PR does not need a new changelog entry. [Instructions](https://github.com/scanapi/scanapi/wiki/Changelog). +- [ ] I have added/updated unit tests. [Instructions](https://github.com/scanapi/scanapi/wiki/Writing-Tests). +- [ ] New and existing unit tests pass locally with my changes. [Instructions](https://github.com/scanapi/scanapi/wiki/Run-ScanAPI-Locally#tests) +- [ ] I have self-documented code my changes by adding docstring(s) and comment(s). [Instructions](https://github.com/scanapi/scanapi/wiki/First-Pull-Request#7-make-your-changes) +- [ ] Current PR does not significantly decrease the code coverage and docstring coverage. +- [ ] My code follows the style guidelines of this project. +- [ ] I have run ScanAPI locally and manually tested my changes. [Instructions](https://github.com/scanapi/scanapi/wiki/Run-ScanAPI-Locally). + +## Issue + +Closes From 0f7c7e0d3cfdd4d3fbc2b694c816e436038788ac Mon Sep 17 00:00:00 2001 From: Pradhvan Bisht Date: Thu, 3 Jun 2021 19:44:49 +0530 Subject: [PATCH 04/11] Fixes PRTemplate to show up on a new PR (#388) * Moved the template dir to `.github/pull_request_template.md` Closes: https://github.com/scanapi/scanapi/issues/383 --- .github/{PULL_REQUEST_TEMPLATE => }/pull_request_template.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{PULL_REQUEST_TEMPLATE => }/pull_request_template.md (100%) diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/pull_request_template.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE/pull_request_template.md rename to .github/pull_request_template.md From 67ac683de32d44355ebc3cdc97f1361c8f2b781b Mon Sep 17 00:00:00 2001 From: Hebert <4763091+hebertjulio@users.noreply.github.com> Date: Mon, 7 Jun 2021 11:47:06 -0300 Subject: [PATCH 05/11] Show on report the scanapi version used to generate it (#379) (#386) --- CHANGELOG.md | 2 ++ scanapi/reporter.py | 17 ++++++++++++++--- scanapi/templates/report.html | 15 +++++++++++++++ tests/unit/test_reporter.py | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5fb760..65bdb5bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## Added +- Show on report the scanapi version used to generate it. [#386](https://github.com/scanapi/scanapi/pull/386) ## [2.3.0] - 2021-05-25 ### Added diff --git a/scanapi/reporter.py b/scanapi/reporter.py index 8fe7fb6e..099ab717 100644 --- a/scanapi/reporter.py +++ b/scanapi/reporter.py @@ -3,6 +3,8 @@ import logging from os.path import abspath +from pkg_resources import get_distribution + from scanapi.session import session from scanapi.settings import settings from scanapi.template_render import render @@ -17,7 +19,12 @@ def __init__(self, output_path=None, template=None): self.template = template def write(self, results): - """Part of the Reporter instance that is responsible for writing scanapi-report.html.""" + """Part of the Reporter instance that is responsible for writing scanapi-report.html. + Args: + results [generator]: generator of dicts resulting of Request run(). + Returns: + None + """ logger.info("Writing documentation") template_path = self.template if self.template else "report.html" @@ -34,12 +41,16 @@ def write(self, results): @staticmethod def _build_context(results): - """Private method of Reporter returns dict containing keys datetime, - project_name, results and session and their corresponding values. + """Build context dict of values required to render template. + Args: + results [generator]: generator of dicts resulting of Request run(). + Returns: + [dict]: values required to render template. """ return { "now": datetime.datetime.now().replace(microsecond=0), "project_name": settings.get("project_name", ""), "results": results, "session": session, + "scanapi_version": get_distribution("scanapi").version, } diff --git a/scanapi/templates/report.html b/scanapi/templates/report.html index e6a63f9f..a95c5a16 100644 --- a/scanapi/templates/report.html +++ b/scanapi/templates/report.html @@ -142,6 +142,17 @@ width: 30px; } + .scanapi_version { + display: flex; + flex-direction: column; + align-items: center; + margin: 20px 0; + font-size: 16px; + color: #636c73; + text-align: center; + padding: 0; + } + .wrapper, .header { width: 1150px; @@ -570,6 +581,10 @@

Tests Summary

+
+ Generated by ScanAPI {{ scanapi_version }} +
+