Package com.pugh.sockso.tests

Examples of com.pugh.sockso.tests.TestRequest


        String html = res.getOutput();
        assertTrue( html.contains("admin-console") );
    }

    public void testTheSendUrlProcessesAConsoleCommand() throws Exception {
        TestRequest req = new TestRequest( "GET /admin/console/send HTTP/1.0" );
        req.setArgument( "command", "propset foo bar" );
        c.setRequest( req );
        c.handleAdminRequest();
        assertEquals( "bar", p.get("foo") );
    }
View Full Code Here


       
        testUser = new User( -1, "foo" );

        db = new TestDatabase();
        p = new StringProperties();
        req = new TestRequest( "" );
        resp = new TestResponse();
        u = new Userer();
        u.addAuthenticator( new DBAuthenticator(db) );
        u.setDatabase( db );
        u.setRequest( req );
View Full Code Here

    }

    public void testLogout() throws IOException {
       
        Database db = createMock( Database.class );
        Request req = new TestRequest( "/" );
        Response res = createMock( Response.class );
        Locale locale = createNiceMock( Locale.class );

        Userer u = new Userer();
        u.setRequest( req );
View Full Code Here

        c.handleAdminRequest();
        assertEquals( "bar", p.get("foo") );
    }

    public void testCommandOutputIsSentViaTheResponseObject() throws Exception {
        TestRequest req = new TestRequest( "GET /admin/console/send HTTP/1.0" );
        req.setArgument( "command", "propset foo bar" );
        locale.setString( "con.msg.propertySaved", "property updated" );
        c.setRequest( req );
        c.handleAdminRequest();
        assertContains( res.getOutput(), "property updated" );
    }
View Full Code Here

    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() );
        js.setProperties( p );
View Full Code Here

    }

    public void testLoginNotRequiredWhenServerInfoRequested() {
       
        Request req = new TestRequest( "GET /json/serverinfo HTTP/1.1" );
        Jsoner j = new Jsoner( null, null );
        j.setRequest( req );

        assertFalse( j.requiresLogin() );
View Full Code Here

        p.set( Constants.WWW_BROWSE_FOLDERS_ENABLED, Properties.YES );
        db = new TestDatabase();
    }
   
    protected TracksRequest getInstance( final String resource ) throws Exception {
        req = new TestRequest( "GET " +resource+ " HTTP/1.1" );
        db.fixture( "artistsAlbumsAndTracks" );
        return new TracksRequest( req, db, p );
    }
View Full Code Here

TOP

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

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.