def test_nonexistent_project(): args = docopt(doc, "run project_unknown project2") rc = run.RunCommand(args) with output() as out: rc.execute_command() alert = out.getvalue().strip() expected_alert = "project_unknown.json does not exist. Use ``scrapple genconfig``." assert_in(expected_alert, alert)
def test_run_xpath_crawler(): args = docopt(doc, "run project4 result4") rc = run.RunCommand(args) rc.execute_command() with open(os.path.join(os.getcwd(), 'result4.json'), 'r') as f: result = json.load(f) with open(os.path.join(os.getcwd(), 'expected_result4.json'), 'r') as f: expected_result = json.load(f) assert_dict_equal(result, expected_result)
def test_if_run_instance_created(): args = docopt(doc, "run project1 test_project") rc = run.RunCommand(args) assert_is_instance(rc, run.RunCommand)