FRepoInfoTest.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import <XCTest/XCTest.h>
  18. #import "FRepoInfo.h"
  19. #import "FTestHelpers.h"
  20. @interface FRepoInfoTest : XCTestCase
  21. @end
  22. @implementation FRepoInfoTest
  23. - (void) testGetConnectionUrl {
  24. FRepoInfo *info = [[FRepoInfo alloc] initWithHost:@"test-namespace.example.com"
  25. isSecure:NO
  26. withNamespace:@"tests"];
  27. XCTAssertEqualObjects(info.connectionURL, @"ws://test-namespace.example.com/.ws?v=5&ns=tests",
  28. @"getConnection works");
  29. }
  30. - (void) testGetConnectionUrlWithLastSession {
  31. FRepoInfo *info = [[FRepoInfo alloc] initWithHost:@"tests-namespace.example.com"
  32. isSecure:NO
  33. withNamespace:@"tests"];
  34. XCTAssertEqualObjects([info connectionURLWithLastSessionID:@"testsession"],
  35. @"ws://tests-namespace.example.com/.ws?v=5&ns=tests&ls=testsession",
  36. @"getConnectionWithLastSession works");
  37. }
  38. @end