aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/apitests.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/apitests.rs b/tests/apitests.rs
index 58be302..54b7961 100644
--- a/tests/apitests.rs
+++ b/tests/apitests.rs
@@ -18,7 +18,6 @@
use ramaskrik;
use ramaskrik::models::{
- self,
film::{ Film, NewFilm },
room::Room,
screening,
@@ -125,25 +124,25 @@ fn getting_films_from_api() {
#[test]
fn getting_screenings_from_api() {
server_with_db(|server, db| {
- let r = models::room::by_name("Main room", &db).unwrap();
- let f = models::film::by_title("Hellraiser", &db).unwrap();
- screening::create(&r, &f,
+ let r = db.get_room_by_name("Main room").unwrap();
+ let f = db.get_film_by_title("Hellraiser").unwrap();
+
+ db.create_screening(&r, &f,
chrono::NaiveDate::from_ymd(2019, 10, 21),
chrono::NaiveTime::from_hms(18, 00, 00),
- chrono::NaiveTime::from_hms(19, 34, 00),
- &db).unwrap();
+ chrono::NaiveTime::from_hms(19, 34, 00)).unwrap();
let client = rocket::local::Client::new(server).unwrap();
let mut response = client.get("/screenings").dispatch();
assert_eq!(response.content_type(), Some(ContentType::JSON));
- let fetched_screenings: Vec<(screening::Screening, Option<Film>, Option<Room>)> =
+ let fetched_screenings: Vec<(screening::Screening, Film, Room)> =
serde_json::from_str(&response.body_string().unwrap()).unwrap();
assert_eq!(fetched_screenings.len(), 1);
- let (scr, ff, rr) = &fetched_screenings[0];
- assert_eq!(ff.as_ref().unwrap().title, "Hellraiser");
- assert_eq!(rr.as_ref().unwrap().name, "Main room");
+ let (_scr, ff, rr) = &fetched_screenings[0];
+ assert_eq!(ff.title, "Hellraiser");
+ assert_eq!(rr.name, "Main room");
});
}