diff options
author | mtvee <emptyvee@gmail.com> | 2009-05-18 01:06:21 +0000 |
---|---|---|
committer | mtvee <emptyvee@gmail.com> | 2009-05-18 01:06:21 +0000 |
commit | 61da30eb923d774336ad10d252d4d0790999f33f (patch) | |
tree | ed38c0343137633a32e027ef42a6127aff9edb0e /Unit Tests/mcpKitTest.m | |
parent | 6ce469c5f1d99fc3733f4f86d2b046d6abec6728 (diff) | |
download | sequelpro-61da30eb923d774336ad10d252d4d0790999f33f.tar.gz sequelpro-61da30eb923d774336ad10d252d4d0790999f33f.tar.bz2 sequelpro-61da30eb923d774336ad10d252d4d0790999f33f.zip |
- forgot to add the actual test files to the push
Diffstat (limited to 'Unit Tests/mcpKitTest.m')
-rw-r--r-- | Unit Tests/mcpKitTest.m | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Unit Tests/mcpKitTest.m b/Unit Tests/mcpKitTest.m new file mode 100644 index 00000000..486e7c4a --- /dev/null +++ b/Unit Tests/mcpKitTest.m @@ -0,0 +1,61 @@ +// +// mcpKitTest.m +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 TalonEdge Ltd.. All rights reserved. +// + +#import "mcpKitTest.h" + + +@implementation mcpKitTest + +- (void)setUp +{ + // for now, we try an find the following database in the local connection + // if the connection fails for any reasons, tests are not run. + // http://downloads.mysql.com/docs/sakila-db.zip + // set up a user called 'sakila' with no password that has all privs on the + // database 'sakila' + + mySQLConnection = [[CMMCPConnection alloc] initToSocket:@"/var/mysql/mysql.sock" + withLogin:@"sakila" + password:@""]; + + if ( ![mySQLConnection isConnected] ) { + [mySQLConnection dealloc]; + mySQLConnection = nil; + STFail(@"unable to connect with server. No tests run!"); + } else { + if ( ! [mySQLConnection selectDB:@"sakila"]) { + [mySQLConnection dealloc]; + mySQLConnection = nil; + STFail(@"unable to use `sakila` database. No tests run!"); + } + } +} + +- (void)tearDown +{ + if( mySQLConnection != nil ) { + [mySQLConnection disconnect]; + [mySQLConnection dealloc]; + } +} + + +- (void)testTableList +{ + if( mySQLConnection == nil ) + return; + + CMMCPResult *theResult; + + NSString *pQuery = @"SELECT * FROM actor"; + theResult = [mySQLConnection queryString:pQuery]; + + STAssertEquals([theResult numOfRows],(my_ulonglong)200, @"actors table count" ); +} + +@end |