Package com.pugh.sockso.tests

Examples of com.pugh.sockso.tests.TestResponse


   
    private TestDatabase db;

    @Override
    protected void setUp() throws Exception {
        res = new TestResponse();
        db = new TestDatabase();
        db.fixture( "artistsAlbumsAndTracks" );
        action = new ArtistsAction();
        action.setDatabase( db );
        action.setResponse( res );
View Full Code Here


   
    @Override
    protected void setUp() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "playlists" );
        res = new TestResponse();
        action = new PlaylistsAction();
        action.setDatabase( db );
        action.setResponse( res );
        action.setRequest( getRequest("/api/playlists") );
    }
View Full Code Here

            fail( "Expected exception on invalid track id" );
        }
    }
   
    public void testTrackJsonReturnedOnValidRequest() throws Exception {
        TestResponse res = new TestResponse();
        db.fixture( "singleTrack" );
        action.setResponse( res );
        action.setRequest(getRequest( "/api/tracks/1" ));
        action.handleRequest();
        assertContains( res.getOutput(), "My Track" );
        assertContains( res.getOutput(), "My Album" );
        assertContains( res.getOutput(), "My Artist" );
    }
View Full Code Here

   
    private TestResponse res;
   
    @Override
    protected void setUp() {
        res = new TestResponse();
        action = new SessionAction();
        action.setResponse( res );
    }
View Full Code Here

   
    @Override
    protected void setUp() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "albums" );
        res = new TestResponse();
        action = new AlbumsAction();
        action.setDatabase( db );
        action.setResponse( res );
    }
View Full Code Here

       
    }

    public void testHandleRequest() throws Exception {

        TestResponse res = new TestResponse();
        Server sv = createNiceMock( Server.class );
        String skin = "hsdjkahsdjkahsdk";

        Properties p = new StringProperties();
        p.set( "www.skin", skin );

        Request req = new TestRequest( "GET / HTTP/1.1" );

        Sharer s = new Sharer();
        s.setResponse( res );
        s.setRequest( req );
        s.setLocale( locale );
        s.setProperties( p );
        s.handleRequest();

        String data = res.getOutput();

        assertTrue( data.length() > 0 );
        assertTrue( data.contains(skin) );

    }
View Full Code Here

        assertTrue( data.contains(skin) );

    }

    public void testRenderingTheSharePage() throws Exception {
        TestResponse res = new TestResponse();
        Sharer s = new Sharer();
        s.setRequest(new TestRequest("/") );
        s.setLocale( locale );
        s.setResponse( res );
        s.setUser( new User(-1,"foo") );
        s.setProperties( new StringProperties() );
        s.showSharePage( new String[] { "ar123" } );
        String data = res.getOutput();
        assertTrue( data.contains("ar123") );
    }
View Full Code Here

        assertFalse( action.canHandle(getRequest( "/api/albums/123/tracks" )) );
    }
   
    public void testTracksListedWhenArtistIdFound() throws Exception {
        TestDatabase db = new TestDatabase();
        TestResponse res = new TestResponse();
        db.fixture( "tracksForPath" );
        action.setDatabase( db );
        action.setResponse( res );
        action.setRequest(getRequest( "/api/artists/1/tracks" ));
        action.handleRequest();
        assertContains( res.getOutput(), "My Track 1" );
        assertContains( res.getOutput(), "My Track 2" );
        assertContains( res.getOutput(), "My Track 3" );
    }
View Full Code Here

   
    @Override
    protected void setUp() {
        p = new StringProperties();
        p.set( Constants.WWW_USERS_REQUIRE_LOGIN, p.YES );
        res = new TestResponse();
        api = new Api( new ObjectCache(), Guice.createInjector(new SocksoModule(new TestOptionSet())) );
        api.setProperties( p );
        api.setResponse( res );
    }
View Full Code Here

   
    @Override
    protected void setUp() throws Exception {
        db = new TestDatabase();
        db.fixture( "artistsAlbumsAndTracks" );
        res = new TestResponse();
        action = new TracksAction();
        action.setDatabase( db );
        action.setResponse( res );
    }
View Full Code Here

TOP

Related Classes of com.pugh.sockso.tests.TestResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.