This file is indexed.

/usr/share/maas/web/static/js/angular/directives/tests/test_mac_address.js is in maas-region-api 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* Copyright 2015-2016 Canonical Ltd.  This software is licensed under the
 * GNU Affero General Public License version 3 (see the file LICENSE).
 *
 * Unit tests for mac address directive.
 */

describe("maasmacAddress", function() {

  // Load the MAAS module.
  beforeEach(module("MAAS"));

  // Create a new scope before each test.
  var $scope;
  var $window;
  var $document;
  var ngModelCtrl;

  beforeEach(inject(function($rootScope, _$window_, _$document_) {
      $window = _$window_;
      $document = _$document_;
      $scope = $rootScope.$new();
  }));

  // Return the compiled directive with the items from the scope.
  function compileDirective() {
      var directive;
      var html = [
          '<form name="TestForm">',
              '<input type="text"',
                  'id="mac"',
                  'value=""',
                  'name="mac"',
                  'maxlength="17"',
                  'data-ng-model="mac"',
                  'data-ng-pattern="macAddressRegex"',
                  'mac-address>',
          '</form>'
          ].join('');

      $scope.mac = '';
      $scope.macAddressRegex = /^([0-9A-F]{2}[::]){5}([0-9A-F]{2})$/gmi;

      // Compile the directive.
      inject(function($compile) {
          directive = $compile(html)($scope);
      });

      // Perform the digest cycle to finish the compile.
      $scope.$digest();
      return directive.find("form");
  }

  it("MAC address formatting to be valid", function() {
      var directive = compileDirective();
      // set an invalid value
      $scope.TestForm.mac.$setViewValue('00:00:00:00:00:00');
      $scope.$digest();
      expect($scope.TestForm.mac.$valid).toBe(true);
  });

  it("MAC address formatting to be invalid", function() {
      var directive = compileDirective();
      // set an invalid value
      $scope.TestForm.mac.$setViewValue('!"#$%^&*(!"#")"');
      $scope.$digest();
      expect($scope.TestForm.mac.$valid).toBe(false);
  });
});