Jeremy Mowery | 159f97b | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
| 3 | describe('The User List', () => { |
| 4 | |
| 5 | var scope, element, isolatedScope, httpBackend; |
| 6 | |
Jeremy Mowery | 1b09b33 | 2016-04-19 17:01:48 -0700 | [diff] [blame] | 7 | beforeEach(module('xos.openVPNDashboard')); |
Jeremy Mowery | 159f97b | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 8 | beforeEach(module('templates')); |
| 9 | |
| 10 | beforeEach(inject(function($httpBackend, $compile, $rootScope){ |
| 11 | |
| 12 | httpBackend = $httpBackend; |
| 13 | // Setting up mock request |
Matteo Scandolo | 9ef11a8 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 14 | $httpBackend.expectGET('/api/tenant/openvpn/list/?no_hyperlinks=1').respond([ |
Jeremy Mowery | 159f97b | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 15 | { |
| 16 | email: 'jermowery@email.arizona.edu', |
| 17 | firstname: 'Jeremy', |
| 18 | lastname: 'Mowery' |
| 19 | } |
| 20 | ]); |
| 21 | |
| 22 | scope = $rootScope.$new(); |
Matteo Scandolo | 9ef11a8 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 23 | element = angular.element('<vpn-list></vpn-list>'); |
Jeremy Mowery | 159f97b | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 24 | $compile(element)(scope); |
| 25 | scope.$digest(); |
| 26 | isolatedScope = element.isolateScope().vm; |
| 27 | })); |
| 28 | |
Matteo Scandolo | 9ef11a8 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 29 | it('should load 1 vpn', () => { |
Jeremy Mowery | 159f97b | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 30 | httpBackend.flush(); |
Matteo Scandolo | 9ef11a8 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 31 | expect(isolatedScope.vpns.length).toBe(1); |
Jeremy Mowery | 159f97b | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 32 | }); |
| 33 | |
| 34 | }); |