mirror of
https://github.com/Findus23/new-github-changelog-generator.git
synced 2024-08-27 19:52:18 +02:00
kind of tests
This commit is contained in:
parent
a364cb6e00
commit
1fda4f19ef
5 changed files with 2794 additions and 0 deletions
|
@ -1,6 +1,14 @@
|
||||||
|
atomicwrites==1.3.0
|
||||||
|
attrs==18.2.0
|
||||||
certifi==2018.11.29
|
certifi==2018.11.29
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
idna==2.8
|
idna==2.8
|
||||||
|
more-itertools==5.0.0
|
||||||
pkg-resources==0.0.0
|
pkg-resources==0.0.0
|
||||||
|
pluggy==0.8.1
|
||||||
|
py==1.7.0
|
||||||
|
pytest==4.2.0
|
||||||
|
PyYAML==3.13
|
||||||
requests==2.21.0
|
requests==2.21.0
|
||||||
|
six==1.12.0
|
||||||
urllib3==1.24.1
|
urllib3==1.24.1
|
||||||
|
|
2734
tests/api_responses/issues.json
Normal file
2734
tests/api_responses/issues.json
Normal file
File diff suppressed because it is too large
Load diff
13
tests/test_author.py
Normal file
13
tests/test_author.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from generator import Author
|
||||||
|
|
||||||
|
|
||||||
|
def test_two_authors_with_same_username_are_equal():
|
||||||
|
author1 = Author({"login": "testuser", "html_url": "https://github.com/testuser"})
|
||||||
|
author2 = Author({"login": "testuser", "html_url": "https://github.com/testuser"})
|
||||||
|
assert author1 == author2
|
||||||
|
|
||||||
|
|
||||||
|
def test_two_authors_with_different_username_are_not_equal():
|
||||||
|
author1 = Author({"login": "testuser", "html_url": "https://github.com/testuser"})
|
||||||
|
author2 = Author({"login": "testinguser", "html_url": "https://github.com/testuser"})
|
||||||
|
assert author1 != author2
|
21
tests/test_fixtures.py
Normal file
21
tests/test_fixtures.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import json
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from generator import Issue
|
||||||
|
|
||||||
|
|
||||||
|
def load_json(path):
|
||||||
|
with open(path) as file:
|
||||||
|
return json.load(file)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def issues(request):
|
||||||
|
issues = []
|
||||||
|
for i in load_json(request.fspath.join('../api_responses/').join("issues.json")):
|
||||||
|
issue = Issue(i)
|
||||||
|
issue.compare_close_date(datetime.strptime("2019-01-25 00:00:00", "%Y-%m-%d %H:%M:%S"))
|
||||||
|
issues.append(issue)
|
||||||
|
return issues
|
18
tests/test_issues.py
Normal file
18
tests/test_issues.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
|
from tests.test_fixtures import *
|
||||||
|
|
||||||
|
|
||||||
|
def test_issues_can_be_read(issues):
|
||||||
|
for issue in issues:
|
||||||
|
assert issue.authors is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_test(issues):
|
||||||
|
assert len([i for i in issues if i.closed_before_since]) == 3
|
||||||
|
|
||||||
|
|
||||||
|
def test_correct_included_issues(issues):
|
||||||
|
correct = [13418, 13626, 13836, 13991, 14027]
|
||||||
|
included = [i for i in issues if i.should_be_included]
|
||||||
|
should_be_included = [i for i in issues if i.number in correct]
|
||||||
|
assert included == should_be_included
|
Loading…
Reference in a new issue