Skip to content

Commit

Permalink
tests: naming nad don't load directly from file
Browse files Browse the repository at this point in the history
Signed-off-by: Szymon Łopaciuk <[email protected]>
  • Loading branch information
szymonlopaciuk committed Dec 14, 2017
1 parent 3adeb2a commit 4ef28d2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions tests/unit/test_oaipmh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# more details.

from datetime import datetime
import json
from mock import patch
import pytest

Expand Down Expand Up @@ -61,9 +60,6 @@ def test_load_last_run(spider, cleanup):
now = datetime.utcnow()
spider._save_run(started_at=now)

file_path = spider._last_run_file_path()
result = override_dynamic_fields(json.load(open(file_path)))

expected = override_dynamic_fields({
'spider': 'OAI-PMH',
'url': 'http://0.0.0.0/oai2',
Expand All @@ -75,14 +71,12 @@ def test_load_last_run(spider, cleanup):
'last_run_finished_at': '2017-12-08T13:55:00.000000',
})

assert expected == result

result = override_dynamic_fields(spider._load_last_run())

assert expected == result


def test_load_nonexistent(spider):
def test_load_last_run_nonexistent(spider):
with pytest.raises(NoLastRunToLoad):
spider._load_last_run()

Expand Down

0 comments on commit 4ef28d2

Please sign in to comment.