Jeremy Mowery | 6efeb7a | 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 | 81e84cc | 2016-04-19 17:01:48 -0700 | [diff] [blame] | 7 | beforeEach(module('xos.openVPNDashboard')); |
Jeremy Mowery | 6efeb7a | 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 | e993b88 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 14 | $httpBackend.expectGET('/api/tenant/openvpn/list/?no_hyperlinks=1').respond([ |
Jeremy Mowery | 6efeb7a | 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 | e993b88 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 23 | element = angular.element('<vpn-list></vpn-list>'); |
Jeremy Mowery | 6efeb7a | 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 | e993b88 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 29 | it('should load 1 vpn', () => { |
Jeremy Mowery | 6efeb7a | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 30 | httpBackend.flush(); |
Matteo Scandolo | e993b88 | 2016-05-17 17:30:14 -0700 | [diff] [blame] | 31 | expect(isolatedScope.vpns.length).toBe(1); |
Jeremy Mowery | 6efeb7a | 2016-02-25 09:32:00 -0700 | [diff] [blame] | 32 | }); |
| 33 | |
| 34 | }); |