When testing we dont have api access so we create cache entries before each request. The cache key changed so this is now updated in the tests and tmdb.
This commit is contained in:
13
seasoned_api/test/fixtures/arrival-info-success-response.json
vendored
Normal file
13
seasoned_api/test/fixtures/arrival-info-success-response.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"background_path": "/yIZ1xendyqKvY3FGeeUYUd5X9Mm.jpg",
|
||||
"id": 329865,
|
||||
"popularity": 26.978601,
|
||||
"poster_path": "/hLudzvGfpi6JlwUnsNhXwKKg4j.jpg",
|
||||
"release_status": "Released",
|
||||
"score": 7.3,
|
||||
"summary": "Taking place after alien crafts land around the world, an expert linguist is recruited by the military to determine whether they come in peace or are a threat.",
|
||||
"tagline": "Why are they here?",
|
||||
"title": "Arrival",
|
||||
"type": "movie",
|
||||
"year": 2016
|
||||
}
|
||||
@@ -7,7 +7,7 @@ const popularMoviesSuccess = require('test/fixtures/popular-movies-success-respo
|
||||
|
||||
describe('As a user I want to get popular movies', () => {
|
||||
before(() => resetDatabase());
|
||||
before(() => createCacheEntry('p:movie::1', popularMoviesSuccess));
|
||||
before(() => createCacheEntry('p:movie:1', popularMoviesSuccess));
|
||||
|
||||
it('should return 200 with the information', () =>
|
||||
request(app)
|
||||
|
||||
@@ -7,7 +7,7 @@ const popularShowsSuccess = require('test/fixtures/popular-show-success-response
|
||||
|
||||
describe('As a user I want to get popular shows', () => {
|
||||
before(() => resetDatabase());
|
||||
before(() => createCacheEntry('p:show::1', popularShowsSuccess));
|
||||
before(() => createCacheEntry('p:show:1', popularShowsSuccess));
|
||||
|
||||
it('should return 200 with the information', () =>
|
||||
request(app)
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
const resetDatabase = require('test/helpers/resetDatabase');
|
||||
const createCacheEntry = require('test/helpers/createCacheEntry');
|
||||
const app = require('src/webserver/app');
|
||||
const request = require('supertest-as-promised');
|
||||
const createUser = require('test/helpers/createUser');
|
||||
const createToken = require('test/helpers/createToken');
|
||||
const infoMovieSuccess = require('test/fixtures/arrival-info-success-response.json');
|
||||
|
||||
describe('As a user I want to request a movie', () => {
|
||||
before(() => {
|
||||
return resetDatabase()
|
||||
.then(() => createUser('test_user', 'test@gmail.com', 'password'));
|
||||
})
|
||||
before(() => createCacheEntry('i:movie:329865', infoMovieSuccess));
|
||||
|
||||
it('should return 200 when item is requested', () =>
|
||||
request(app)
|
||||
|
||||
@@ -6,7 +6,7 @@ const interstellarQuerySuccess = require('test/fixtures/interstellar-query-succe
|
||||
|
||||
describe('As an anonymous user I want to search for a movie', () => {
|
||||
before(() => resetDatabase());
|
||||
before(() => createCacheEntry('s:1:movie:interstellar', interstellarQuerySuccess));
|
||||
before(() => createCacheEntry('se:1:multi:interstellar', interstellarQuerySuccess));
|
||||
|
||||
it('should return 200 with the search results even if user is not logged in', () =>
|
||||
request(app)
|
||||
|
||||
Reference in New Issue
Block a user