-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #788 from CanalTP/output-zip
- Loading branch information
Showing
19 changed files
with
530 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
authors = ["Kisio Digital <[email protected]>", "Guillaume Pinot <[email protected]>"] | ||
name = "transit_model" | ||
version = "0.37.0" | ||
version = "0.38.0" | ||
license = "AGPL-3.0-only" | ||
description = "Transit data management" | ||
repository = "https://github.com/CanalTP/transit_model" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
use assert_cmd::prelude::*; | ||
use std::process::Command; | ||
use tempfile::TempDir; | ||
|
||
#[test] | ||
fn test_gtfs2netexfr() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
Command::cargo_bin("gtfs2netexfr") | ||
.expect("Failed to find binary 'gtfs2netexfr'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/netex_france/input_gtfs") | ||
.arg("--output") | ||
.arg(output_dir.path().to_str().unwrap()) | ||
.arg("--participant") | ||
.arg("Participant") | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(output_dir.path().join("arrets.xml").is_file()); | ||
} | ||
|
||
#[test] | ||
fn test_gtfs2netexfr_without_dir() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
let unexisting_dir = output_dir.path().join("unexisting-dir"); | ||
Command::cargo_bin("gtfs2netexfr") | ||
.expect("Failed to find binary 'gtfs2netexfr'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/netex_france/input_gtfs") | ||
.arg("--output") | ||
.arg(unexisting_dir.to_str().unwrap()) | ||
.arg("--participant") | ||
.arg("Participant") | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(unexisting_dir.join("arrets.xml").is_file()); | ||
} | ||
|
||
#[test] | ||
fn test_gtfs2netexfr_create_zip() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
let netexfr_zip = output_dir.path().join("netexfr.zip"); | ||
assert!(!netexfr_zip.exists()); | ||
Command::cargo_bin("gtfs2netexfr") | ||
.expect("Failed to find binary 'gtfs2netexfr'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/netex_france/input_gtfs") | ||
.arg("--output") | ||
.arg(netexfr_zip.to_str().unwrap()) | ||
.arg("--participant") | ||
.arg("Participant") | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(netexfr_zip.is_file()); | ||
} | ||
|
||
#[test] | ||
fn test_gtfs2netexfr_create_not_zip_extension() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
let netexfr_foobar = output_dir.path().join("netexfr.foobar"); | ||
Command::cargo_bin("gtfs2netexfr") | ||
.expect("Failed to find binary 'gtfs2netexfr'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/netex_france/input_gtfs") | ||
.arg("--output") | ||
.arg(netexfr_foobar.to_str().unwrap()) | ||
.arg("--participant") | ||
.arg("Participant") | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(netexfr_foobar.join("arrets.xml").is_file()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
use assert_cmd::prelude::*; | ||
use std::process::Command; | ||
use tempfile::TempDir; | ||
|
||
#[test] | ||
fn test_gtfs2ntfs() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
Command::cargo_bin("gtfs2ntfs") | ||
.expect("Failed to find binary 'gtfs2ntfs'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/gtfs2ntfs/minimal/input") | ||
.arg("--output") | ||
.arg(output_dir.path().to_str().unwrap()) | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(output_dir.path().join("feed_infos.txt").is_file()); | ||
} | ||
|
||
#[test] | ||
fn test_gtfs2ntfs_create_output_directory() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
let unexisting_dir = output_dir.path().join("unexisting-folder"); | ||
Command::cargo_bin("gtfs2ntfs") | ||
.expect("Failed to find binary 'gtfs2ntfs'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/gtfs2ntfs/minimal/input") | ||
.arg("--output") | ||
.arg(unexisting_dir.to_str().unwrap()) | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(unexisting_dir.join("feed_infos.txt").is_file()); | ||
} | ||
|
||
#[test] | ||
fn test_gtfs2ntfs_create_zip() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
let ntfs_zip = output_dir.path().join("ntfs.zip"); | ||
assert!(!ntfs_zip.exists()); | ||
Command::cargo_bin("gtfs2ntfs") | ||
.expect("Failed to find binary 'gtfs2ntfs'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/gtfs2ntfs/minimal/input") | ||
.arg("--output") | ||
.arg(ntfs_zip.to_str().unwrap()) | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(ntfs_zip.is_file()); | ||
} | ||
|
||
#[test] | ||
fn test_gtfs2ntfs_create_not_zip_extension() { | ||
let output_dir = TempDir::new().expect("create temp dir failed"); | ||
let ntfs_foobar = output_dir.path().join("ntfs.foobar"); | ||
assert!(!ntfs_foobar.exists()); | ||
Command::cargo_bin("gtfs2ntfs") | ||
.expect("Failed to find binary 'gtfs2ntfs'") | ||
.arg("--input") | ||
.arg("../tests/fixtures/gtfs2ntfs/minimal/input") | ||
.arg("--output") | ||
.arg(ntfs_foobar.to_str().unwrap()) | ||
.arg("--current-datetime") | ||
.arg("2019-04-03T17:19:00Z") | ||
.assert() | ||
.success(); | ||
assert!(ntfs_foobar.join("feed_infos.txt").is_file()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.