diff options
author | stuconnolly <stuart02@gmail.com> | 2012-04-01 20:39:57 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-04-01 20:39:57 +0000 |
commit | 389b86985d977f81f840112249da5e3e278921e2 (patch) | |
tree | 347425c21b25296bc03ce3bd416c8cd4410a2daf /UnitTests | |
parent | 66ebdb1cffe636c0d7586a5bc3867df00839820c (diff) | |
download | sequelpro-389b86985d977f81f840112249da5e3e278921e2.tar.gz sequelpro-389b86985d977f81f840112249da5e3e278921e2.tar.bz2 sequelpro-389b86985d977f81f840112249da5e3e278921e2.zip |
Tidy up.
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 |