forked from diesel-rs/diesel
-
Notifications
You must be signed in to change notification settings - Fork 0
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 diesel-rs#4087 from VicVerevita/postgresql-integra…
…tion-tests getting started integration tests
- Loading branch information
Showing
18 changed files
with
300 additions
and
0 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
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,10 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn show_posts() { | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} |
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,27 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn write_post() { | ||
let _ = Command::cargo_bin("write_post") | ||
.unwrap() | ||
.write_stdin("Test Title\ntest text\n1 2 3") | ||
.assert() | ||
.append_context("write_post", "") | ||
.stdout( | ||
"What would you like your title to be?\n\nOk! Let's write Test Title (Press " | ||
.to_owned() | ||
+ EOF | ||
+ " when finished)\n\n\nSaved draft Test Title with id 1\n", | ||
); | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} | ||
|
||
#[cfg(not(windows))] | ||
const EOF: &str = "CTRL+D"; | ||
|
||
#[cfg(windows)] | ||
const EOF: &str = "CTRL+Z"; |
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,54 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn publish_post() { | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
|
||
let _ = Command::cargo_bin("write_post") | ||
.unwrap() | ||
.write_stdin("Test Title\ntest text\n1 2 3") | ||
.assert() | ||
.append_context("write_post", "") | ||
.stdout( | ||
"What would you like your title to be?\n\nOk! Let's write Test Title (Press " | ||
.to_owned() | ||
+ EOF | ||
+ " when finished)\n\n\nSaved draft Test Title with id 1\n", | ||
); | ||
|
||
let _ = Command::cargo_bin("publish_post") | ||
.unwrap() | ||
.arg("1") | ||
.assert() | ||
.append_context("publish_post", "") | ||
.stdout("Published post Test Title\n"); | ||
|
||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 1 posts\nTest Title\n-----------\n\ntest text\n1 2 3\n"); | ||
|
||
let _ = Command::cargo_bin("delete_post") | ||
.unwrap() | ||
.arg("Test Title") | ||
.assert() | ||
.append_context("delete_post", "") | ||
.stdout("Deleted 1 posts\n"); | ||
|
||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} | ||
|
||
#[cfg(not(windows))] | ||
const EOF: &str = "CTRL+D"; | ||
|
||
#[cfg(windows)] | ||
const EOF: &str = "CTRL+Z"; |
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,10 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn show_posts() { | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} |
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,27 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn write_post() { | ||
let _ = Command::cargo_bin("write_post") | ||
.unwrap() | ||
.write_stdin("Test Title\ntest text\n1 2 3") | ||
.assert() | ||
.append_context("write_post", "") | ||
.stdout( | ||
"What would you like your title to be?\n\nOk! Let's write Test Title (Press " | ||
.to_owned() | ||
+ EOF | ||
+ " when finished)\n\n\nSaved draft Test Title with id 1\n", | ||
); | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} | ||
|
||
#[cfg(not(windows))] | ||
const EOF: &str = "CTRL+D"; | ||
|
||
#[cfg(windows)] | ||
const EOF: &str = "CTRL+Z"; |
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,54 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn publish_post() { | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
|
||
let _ = Command::cargo_bin("write_post") | ||
.unwrap() | ||
.write_stdin("Test Title\ntest text\n1 2 3") | ||
.assert() | ||
.append_context("write_post", "") | ||
.stdout( | ||
"What would you like your title to be?\n\nOk! Let's write Test Title (Press " | ||
.to_owned() | ||
+ EOF | ||
+ " when finished)\n\n\nSaved draft Test Title with id 1\n", | ||
); | ||
|
||
let _ = Command::cargo_bin("publish_post") | ||
.unwrap() | ||
.arg("1") | ||
.assert() | ||
.append_context("publish_post", "") | ||
.stdout("Published post Test Title\n"); | ||
|
||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 1 posts\nTest Title\n-----------\n\ntest text\n1 2 3\n"); | ||
|
||
let _ = Command::cargo_bin("delete_post") | ||
.unwrap() | ||
.arg("Test Title") | ||
.assert() | ||
.append_context("delete_post", "") | ||
.stdout("Deleted 1 posts\n"); | ||
|
||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} | ||
|
||
#[cfg(not(windows))] | ||
const EOF: &str = "CTRL+D"; | ||
|
||
#[cfg(windows)] | ||
const EOF: &str = "CTRL+Z"; |
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,10 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn show_posts() { | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} |
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,27 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn write_post() { | ||
let _ = Command::cargo_bin("write_post") | ||
.unwrap() | ||
.write_stdin("Test Title\ntest text\n1 2 3") | ||
.assert() | ||
.append_context("write_post", "") | ||
.stdout( | ||
"What would you like your title to be?\n\nOk! Let's write Test Title (Press " | ||
.to_owned() | ||
+ EOF | ||
+ " when finished)\n\n\nSaved draft Test Title with id 1\n", | ||
); | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} | ||
|
||
#[cfg(not(windows))] | ||
const EOF: &str = "CTRL+D"; | ||
|
||
#[cfg(windows)] | ||
const EOF: &str = "CTRL+Z"; |
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,54 @@ | ||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn publish_post() { | ||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
|
||
let _ = Command::cargo_bin("write_post") | ||
.unwrap() | ||
.write_stdin("Test Title\ntest text\n1 2 3") | ||
.assert() | ||
.append_context("write_post", "") | ||
.stdout( | ||
"What would you like your title to be?\n\nOk! Let's write Test Title (Press " | ||
.to_owned() | ||
+ EOF | ||
+ " when finished)\n\n\nSaved draft Test Title with id 1\n", | ||
); | ||
|
||
let _ = Command::cargo_bin("publish_post") | ||
.unwrap() | ||
.arg("1") | ||
.assert() | ||
.append_context("publish_post", "") | ||
.stdout("Published post Test Title\n"); | ||
|
||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 1 posts\nTest Title\n-----------\n\ntest text\n1 2 3\n"); | ||
|
||
let _ = Command::cargo_bin("delete_post") | ||
.unwrap() | ||
.arg("Test Title") | ||
.assert() | ||
.append_context("delete_post", "") | ||
.stdout("Deleted 1 posts\n"); | ||
|
||
let _ = Command::cargo_bin("show_posts") | ||
.unwrap() | ||
.assert() | ||
.append_context("show_posts", "") | ||
.stdout("Displaying 0 posts\n"); | ||
} | ||
|
||
#[cfg(not(windows))] | ||
const EOF: &str = "CTRL+D"; | ||
|
||
#[cfg(windows)] | ||
const EOF: &str = "CTRL+Z"; |