diff options
author | stuconnolly <stuart02@gmail.com> | 2012-04-16 20:16:52 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-04-16 20:16:52 +0000 |
commit | 4cad6f0e6e4fb497b480256c2abe3de34ebf225c (patch) | |
tree | b66d6a72a1537cf98624acf3c685f1a4d916fd86 /UnitTests | |
parent | 0d3b69f964a8d9d93ca794d457b461463f1ec95d (diff) | |
download | sequelpro-4cad6f0e6e4fb497b480256c2abe3de34ebf225c.tar.gz sequelpro-4cad6f0e6e4fb497b480256c2abe3de34ebf225c.tar.bz2 sequelpro-4cad6f0e6e4fb497b480256c2abe3de34ebf225c.zip |
Bring outline view branch up to date with trunk.
Diffstat (limited to 'UnitTests')
-rw-r--r-- | UnitTests/MCPKitTest.h | 46 | ||||
-rw-r--r-- | UnitTests/MCPKitTest.m | 123 |
2 files changed, 0 insertions, 169 deletions
diff --git a/UnitTests/MCPKitTest.h b/UnitTests/MCPKitTest.h deleted file mode 100644 index 926780fa..00000000 --- a/UnitTests/MCPKitTest.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// -// MCPKitTest.h -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at <http://code.google.com/p/sequel-pro/> - -#import <SenTestingKit/SenTestingKit.h> - -@class MCPConnection; - -/** - * @class MCPKitTest MCPKitTest.h - * - * MCPKit test case class. - * - * Note that this test case class uses the 'sakila' database to perform it's tests. It is available from: - * - * http://downloads.mysql.com/docs/sakila-db.zip - * - * You must also create a user called 'sp_tester' with no password and all permissions on the database 'sakila'. - */ -@interface MCPKitTest : SenTestCase -{ - MCPConnection *connection; -} - -@end diff --git a/UnitTests/MCPKitTest.m b/UnitTests/MCPKitTest.m deleted file mode 100644 index 559a1407..00000000 --- a/UnitTests/MCPKitTest.m +++ /dev/null @@ -1,123 +0,0 @@ -// -// $Id$ -// -// MCPKitTest.m -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at <http://code.google.com/p/sequel-pro/> - -#import <MCPKit/MCPKit.h> - -#import "MCPKitTest.h" - -static NSString *SPTestDatabaseHost = @"127.0.0.1"; -static NSString *SPTestDatabaseName = @"sakila"; -static NSString *SPTestDatabaseUser = @"sp_tester"; -static NSString *SPTestDatabasePassword = @""; - -static const NSInteger SPTestDatabasePort = 3306; - -@implementation MCPKitTest - -#pragma mark - -#pragma mark Setup & tear down - -/** - * Sets up the connection for use in the test cases. - */ -- (void)setUp -{ - connection = [[MCPConnection alloc] initToHost:SPTestDatabaseHost withLogin:SPTestDatabaseUser usingPort:SPTestDatabasePort]; - - [connection setPassword:SPTestDatabasePassword]; - - [connection setConnectionTimeout:10]; - [connection setUseKeepAlive:1]; - [connection setKeepAliveInterval:60]; - - [connection connect]; - - if (![connection isConnected]) { - [connection release], connection = nil; - - STFail(@"Error connecting to database server. No tests were run."); - } - else { - if (![connection selectDB:SPTestDatabaseName]) { - [connection release], connection = nil; - - STFail(@"Error selecting database '%@'. No tests were run.", SPTestDatabaseName); - } - } -} - -/** - * Disconnects the connection if connected. - */ -- (void)tearDown -{ - if (connection && [connection isConnected]) { - [connection disconnect]; - } - - [connection release], connection = nil; -} - -#pragma mark - -#pragma mark Tests - -/** - * Tests the connection's major version number. - */ -- (void)testServerMajorVersion -{ - if ((!connection) || (![connection isConnected])) return; - - STAssertTrue(([connection serverMajorVersion] != 0), @"server major version"); -} - -/** - * Tests the connection's version string. - */ -- (void)testServerVersionString -{ - if ((!connection) || (![connection isConnected])) return; - - STAssertTrue(([[connection serverVersionString] length] > 0), @"server version string"); -} - -/** - * Tests the connection query execution. - */ -- (void)testQueryExexution -{ - if ((!connection) || (![connection isConnected])) return; - - MCPResult *result = [connection queryString:@"SELECT * FROM actor"]; - - if ([connection queryErrored]) { - STFail(@"Query execution failed with error: %@", [connection getLastErrorMessage]); - } - else { - STAssertEquals([result numOfRows], (my_ulonglong)200, @"'actors' table count"); - } -} - -@end |