title: hep me to solve unit testing login angularJS
body: <p>My code of login.js is </p>
  
  <pre><code>var loginModule = angular.module('loginModule', [])
          .controller('LoginCtrl', function ($scope, $auth, $location) {
              if (!$auth.isAuthenticated()) {
                  $scope.oneAtATime = true;
                  $scope.login = function () {
                      $auth.login({userName: $scope.username, password: $scope.password, isEncript: false})
                              .then(function () {
                                  console.log($auth.getMessage());
                              })
                              .catch(function (response) {
                                  console.log(response);
                              });
                  };
              }
              else {
                  $location.path('/home');
              }
  
              $scope.status = 'true';
  
          });
  </code></pre>
  
  <p>and unit test code is</p>
  
  <pre><code>describe('login()', function() {
  
          it('should be able to handle login errors', function () {
              var user = {
                  email: 'foo@bar.com',
                  password: '1234',
                  isEncript: false
              };
  
              this.$httpBackend.expectPOST('app/controller/apicall.php?serviceName=login').respond(200);
  
              this.$auth.login(user).then(angular.noop, function () {
  
              });
  
             this.$httpBackend.flush();
  
              expect(user.isEncript).toBe(false);
          });
      });
  
  });
  </code></pre>
  
  <p><strong>......................the error i am getting is below  .......................................</strong></p>
  
  <pre><code>$auth login() should be able to handle login errors FAILED
      Error: Unexpected request: POST ../../controller/apicall.php?serviceName=login
      Expected POST /app/controller/apicall.php?serviceName=login
  </code></pre>
  
  <p>help me to solve how should i solve this error.</p>