File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
TestApp/DeviceAgentUnitTests Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ - (instancetype)init_private {
6565
6666 [_server setTXTRecordDictionary: capabilities];
6767 [self registerRoutes ];
68+ [self setServerPort ];
6869 }
6970 return self;
7071}
@@ -93,8 +94,6 @@ - (void)start {
9394 NSError *error;
9495 BOOL serverStarted = NO ;
9596
96- [self setServerPort ];
97-
9897 DDLogDebug (@" Attempting to start the DeviceAgent server" );
9998 serverStarted = [self attemptToStartWithError: &error];
10099
Original file line number Diff line number Diff line change 11
22#import " CBXServerUnitTestUmbrellaHeader.h"
33#import " CBXCUITestServer.h"
4+ #import " CBXConstants.h"
5+ #import < OCMock/OCMock.h>
46#import " RoutingHTTPServer.h"
57
68@interface CBXCUITestServer (CBXTEST)
@@ -43,4 +45,15 @@ - (void)testInitPrivateSetsServerAndRegistersRoutes {
4345 expect (self.testServer .isFinishedTesting ).to .equal (NO );
4446}
4547
48+ -(void )testInitSetsDefaultPort {
49+ expect (self.testServer .server .port ).equal (CBX_DEFAULT_SERVER_PORT);
50+ }
51+
52+ -(void )testPassingPortFromEnvironment {
53+ id processInfoMock = OCMClassMock ([NSProcessInfo class ]);
54+ OCMStub ([[processInfoMock environment ] objectForKey: @" CbxServerPort" ]).andReturn (" 41799" );
55+
56+ expect (self.testServer .server .port ).equal (41799 );
57+ }
58+
4659@end
You can’t perform that action at this time.
0 commit comments