blob: 522ce7563a2de9427c0e3f24034f5bcb8571b4e9 [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',
18 lastname: 'Mowery'
19 }
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});