blob: 0f49ff32e1bc3160a7df4abfd9010d24677657c8 [file] [log] [blame]
Jeremy Mowery6efeb7a2016-02-25 09:32:00 -07001'use strict';
2
3describe('The User List', () => {
4
5 var scope, element, isolatedScope, httpBackend;
6
Jeremy Mowery81e84cc2016-04-19 17:01:48 -07007 beforeEach(module('xos.openVPNDashboard'));
Jeremy Mowery6efeb7a2016-02-25 09:32:00 -07008 beforeEach(module('templates'));
9
10 beforeEach(inject(function($httpBackend, $compile, $rootScope){
11
12 httpBackend = $httpBackend;
13 // Setting up mock request
Matteo Scandoloe993b882016-05-17 17:30:14 -070014 $httpBackend.expectGET('/api/tenant/openvpn/list/?no_hyperlinks=1').respond([
Jeremy Mowery6efeb7a2016-02-25 09:32:00 -070015 {
16 email: 'jermowery@email.arizona.edu',
17 firstname: 'Jeremy',
Matteo Scandolo195dde92016-07-25 16:43:16 -070018 lastname: 'Mowery'
Jeremy Mowery6efeb7a2016-02-25 09:32:00 -070019 }
20 ]);
21
22 scope = $rootScope.$new();
Matteo Scandoloe993b882016-05-17 17:30:14 -070023 element = angular.element('<vpn-list></vpn-list>');
Jeremy Mowery6efeb7a2016-02-25 09:32:00 -070024 $compile(element)(scope);
25 scope.$digest();
26 isolatedScope = element.isolateScope().vm;
27 }));
28
Matteo Scandoloe993b882016-05-17 17:30:14 -070029 it('should load 1 vpn', () => {
Jeremy Mowery6efeb7a2016-02-25 09:32:00 -070030 httpBackend.flush();
Matteo Scandoloe993b882016-05-17 17:30:14 -070031 expect(isolatedScope.vpns.length).toBe(1);
Jeremy Mowery6efeb7a2016-02-25 09:32:00 -070032 });
33
34});