{"size": 1713, "ext": "js", "max_stars_repo_path": "upstac-ui/__testshared/shared/api/mock-auth.js", "max_stars_repo_name": "jojimathew941/UPSTAC-Application", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "upstac-ui/__testshared/shared/api/mock-auth.js", "max_issues_repo_name": "jojimathew941/UPSTAC-Application", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "upstac-ui/__testshared/shared/api/mock-auth.js", "max_forks_repo_name": "jojimathew941/UPSTAC-Application", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.5344827586, "max_line_length": 93, "alphanum_fraction": 0.7624051372}
import {environment} from "../../../src/environment";
import {mockAny, mockPost, mockServerError} from "../frameworks/mock-http";
import {
    getMockedLoginResponse, getMockedRegisterDoctorResponse, getMockedRegisterTesterResponse,
    getMockedRegisterUserResponse,
    getMockedUserDetailsResponseForNormalUser
} from "../data/auth-responses";

const loginUrl = environment.baseUrl + '/auth/login';
export function setupMocksForValidUserLogin() {
    const userDetailsUrl = environment.baseUrl + '/users/details';
    mockPost(loginUrl, getMockedLoginResponse())
    mockAny(userDetailsUrl, getMockedUserDetailsResponseForNormalUser())
}


export function setupMocksForUploadDocument(id) {

    const url = environment.baseUrl + '/documents/upload/' +id;

    mockAny(url, {status:"Success"})
}

export function setupMockErrorForUploadDocument(id) {

    const url = environment.baseUrl + '/documents/upload/' +id;

    mockServerError(url)
}

export function setupMocksForRegisterUser(name) {
    setupMocksForValidUserLogin();
    const url = environment.baseUrl + '/auth/register';
    mockPost(url, getMockedRegisterUserResponse(name))

}
export function setupMocksForRegisterUserAPIDown() {

    const url = environment.baseUrl + '/auth/register';
    mockServerError(url)

}

export function setupMocksForRegisterDoctor(name) {

    const url = environment.baseUrl + '/auth/doctor/register';
    mockPost(url, getMockedRegisterDoctorResponse(name))

}export function setupMocksForRegisterTester(name) {

    const url = environment.baseUrl + '/auth/tester/register';
    mockPost(url, getMockedRegisterTesterResponse(name))

}
export function setupMocksForInValidUser() {
    mockServerError(loginUrl)
}
