<commit_before>/* tslint:disable:no-unused-variable */

import { async, inject, TestBed } from '@angular/core/testing';
import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';

import { DbUserLogin } from './db-models/login';
import { DbPortal } from './db-models/portal';
import { DbGroup } from './db-models/organ';
import { UserService } from './user.service';
import { PgService } from './pg.service';

class FakePgService {
  public badTokenEvents = new Subject<boolean>();
  public pgcall(url: string, args: any): any {
    switch (url) {
      case 'login/user_login_json':
        return Observable.of({
          usr_token: <PASSWORD>,
          usr_temp_pwd: <PASSWORD>,
          usr_rights: ['organization'],
          participant: {
            par_firstname: 'Philippe',
            par_lastname: 'MARTIN'
          },
          usergroup: {
            ugr_id: 1,
            groups: [
              { grp_id: 1, grp_name: 'a group' }
            ],
            portals: [
              { por_id: 1, por_name: 'a portal' }
            ]
          }
        });
    }
  }
  public setToken(t) {}

  constructor() {
  }
};

describe('Service: User', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [
        UserService,
        { provide: PgService, useClass: FakePgService }<commit_msg>tests ok<commit_after>import { DossiersService } from './dossiers.service';
/* tslint:disable:no-unused-variable */

import { async, inject, TestBed } from '@angular/core/testing';
import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';

import { DbUserLogin } from './db-models/login';
import { DbPortal } from './db-models/portal';
import { DbGroup } from './db-models/organ';
import { UserService } from './user.service';
import { PgService } from './pg.service';

class FakePgService {
  public badTokenEvents = new Subject<boolean>();
  public pgcall(url: string, args: any): any {
    switch (url) {
      case 'login/user_login_json':
        return Observable.of({
          usr_token: <PASSWORD>,
          usr_temp_pwd: false,
          usr_rights: ['organization'],
          participant: {
            par_firstname: 'Philippe',
            par_lastname: 'MARTIN'
          },
          usergroup: {
            ugr_id: 1,
            groups: [
              { grp_id: 1, grp_name: 'a group' }
            ],
            portals: [
              { por_id: 1, por_name: 'a portal' }
            ]
          }
        });

      case 'organ/dossier_list_json':
        return Observable.of([]);
    }
  }
  public setToken(t) { }

  constructor() {
  }
};

describe('Service: User', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [
        UserService, DossiersService,
        { provide: PgService, useClass: FakePgService }
{'fraction_non_alphanumeric': 0.14056505057551447, 'fraction_numerical': 0.0020927799093128706, 'mean_word_length': 2.237020316027088, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7292955', 'n_tokens_mistral': 911, 'n_tokens_neox': 884, 'n_words': 195}