Examples of TestResponse


Examples of com.pugh.sockso.tests.TestResponse

    }
   
    public void testShowUserRegistered() throws Exception {
       
        final Userer u = new Userer();
        final TestResponse res = new TestResponse();

        res.setUser( null );
       
        u.setResponse( res );
        u.showUserRegistered( testUser );

        final String data = res.getOutput();
       
        assertTrue( data.length() > 0 );
        assertTrue( data.contains(testUser.getName()) );
       
    }
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

       
    }

    public void testShowByLetter() throws Exception {
       
        final TestResponse res = new TestResponse();
        final ByLetterer b = new ByLetterer();
        final List<Artist> artists = new ArrayList<Artist>();
        final Artist artist = new Artist.Builder().id(1).name("my artist").build();
        final String letter = "G";

        artists.add( artist );
       
        b.setResponse( res );
        b.showByLetter( letter, artists );
       
        final String data = res.getOutput();

        assertTrue( data.contains(artist.getName()) );
       
    }
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

       
    }
   
    public void testShowScrobbleLog() throws Exception {
       
        final TestResponse res = new TestResponse();
        final Userer u = new Userer();
        final List<Track> tracks = new ArrayList<Track>();
       
        final Artist artist = TestUtils.getArtist();
        final Album album = TestUtils.getAlbum(artist);
        final Genre genre = TestUtils.getGenre();
        final Track track = TestUtils.getTrack(artist, album, genre);

        tracks.add( track );
       
        u.setResponse( res );
        u.showScrobbleLog( tracks );
       
        final String data = res.getOutput();

        // http headers
        assertTrue( data.contains("Content-Disposition") );
        assertTrue( data.contains(".scrobbler.log") );
       
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

    }
   
    public void testShowArtist() throws Exception {
       
        final TestResponse res = new TestResponse();
        final Artister b = new Artister();
        final List<Album> albums = new ArrayList<Album>();
        final Artist artist = TestUtils.getArtist();
        final Album album = TestUtils.getAlbum(artist);

        albums.add( album );
       
        b.setResponse( res );
        b.showArtist( artist, albums );
       
        final String data = res.getOutput();

        assertTrue( data.contains(artist.getName()) );
        assertTrue( data.contains(album.getName()) );
       
    }
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

    @Override
    public void setUp() {
        p = new StringProperties();
        p.set( Constants.WWW_BROWSE_FOLDERS_ENABLED, Properties.YES );
        db = new TestDatabase();
        res = new TestResponse();
        req = new TestRequest( "GET / HTTP/1.1" );
        js = new Jsoner( null, null );
        js.setRequest( req );
        js.setResponse( res );
        js.setLocale( new TestLocale() );
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

   
    public void testShowTracks() throws IOException {
       
        final List<Track> tracks = new ArrayList<Track>();
        final Jsoner j = new Jsoner( null, null );
        final Response res = new TestResponse();
        final Track track = TestUtils.getTrack();
       
        tracks.add( track );
       
        j.setResponse( res );
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

        Properties p = new StringProperties();
        p.set( Constants.WWW_TITLE, "THEtitle" );
        p.set( Constants.WWW_TAGLINE, "THEtagline" );

        TestResponse res = new TestResponse();
        Jsoner j = new Jsoner( null, null );
        j.setProperties( p );
        j.setResponse( res );
        j.serverinfo();

        String data = res.getOutput();

        assertContains( data, "title" );
        assertContains( data, "THEtitle" );

        assertContains( data, "tagline" );
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

    public void testServerInfoReturnsRequireLoginAsOneWhenItIsEnabled() throws Exception {

        Properties p = new StringProperties();
        p.set( Constants.WWW_USERS_REQUIRE_LOGIN, Properties.YES );

        TestResponse res = new TestResponse();
        Jsoner j = new Jsoner( null, null );
        j.setResponse( res );
        j.setProperties( p );
        j.serverinfo();

        String data = res.getOutput();

        assertContains( data, "requiresLogin\":\"1\"" );

    }
View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

        Properties p = new StringProperties();
        p.set( Constants.WWW_TITLE, "THE\"title" );
        p.set( Constants.WWW_TAGLINE, "THE\"tagline" );

        TestResponse res = new TestResponse();
        Jsoner j = new Jsoner( null, null );
        j.setProperties( p );
        j.setResponse( res );
        j.serverinfo();

        String data = res.getOutput();

        assertContains( data, "THE\\\"title" );
        assertContains( data, "THE\\\"tagline" );

View Full Code Here

Examples of com.pugh.sockso.tests.TestResponse

       
    }
   
    public void testShowFolders() throws Exception {
       
        final TestResponse res = new TestResponse();
        final Folderer b = new Folderer();
        final List<Collection> folders = new ArrayList<Collection>();
       
        folders.add( new Collection(12321,"/some/path") );
       
        b.setResponse( res );
        b.showFolders( folders );
       
        final String data = res.getOutput();

        assertTrue( data.contains("12321") );
       
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.