This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
from rest_framework import status | |
from rest_framework.test import APIClient | |
class LoginTestCase(TestCase): | |
def setUp(): | |
self.client = APIClient() | |
self.user = { | |
"username": "andela", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import secrets | |
import string | |
from pyperclip import copy | |
from validators import validators | |
secure_random = secrets.SystemRandom() | |
letters = string.ascii_letters | |
digits = string.digits | |
special = string.punctuation | |
validator = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import { Form, Message } from 'semantic-ui-react'; | |
import Select from 'react-select'; | |
import makeAnimated from 'react-select/lib/animated'; | |
import PropTypes from 'prop-types'; | |
import mapGroupOptions from '../../utils/mapGroups'; | |
import { fetchingGroups } from '../../store/actions/groups'; | |
import { startRegistration } from '../../store/sagas/users'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Button, Modal } from 'semantic-ui-react'; | |
import PropTypes from 'prop-types'; | |
const DeleteUser = ({ closeModal, open, handleDelete }) => { | |
return ( | |
<div> | |
<Modal size="mini" open={open} onClose={closeModal} className="show"> | |
<Modal.Header>Delete user account</Modal.Header> | |
<Modal.Content> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Table, Grid, Container } from 'semantic-ui-react'; | |
import * as PropTypes from 'prop-types'; | |
import ActionButtons from '../common/ActionButtons'; | |
import NoResults from '../common/TableRowLoading/NoResultsRow'; | |
import Loader from '../common/TableRowLoading'; | |
import DeleteUser from './deleteUser'; | |
class DisplayUsers extends Component { | |
state = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { takeLatest, put, call } from 'redux-saga/effects'; | |
import { REGISTERING_USER, EDITING_USER } from '../../../constants/users'; | |
import { | |
registerUserSuccess, | |
registrationStarted, | |
registerUserFailure, | |
} from '.'; | |
import { api } from '../../../utils/api'; | |
export function* registerUser({ payload }) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
REGISTER_USER, | |
REGISTER_ERROR, | |
REGISTER_SUCCESS, | |
} from '../../../constants/users'; | |
const initialState = { | |
status: false, | |
success: false, | |
isRegistering: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const REGISTER_USER = "REGISTER_USER"; | |
export const REGISTER_ERROR = "REGISTER_ERROR"; | |
export const REGISTER_SUCCESS = "REGISTER_SUCCESS"; | |
export const REGISTERING_USER = "REGISTERING_USER"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { mount } from 'enzyme'; | |
import UsersDetails from '../../../components/Users/USersDetails'; | |
import user from '../../../__mocks__/fetchUserData'; | |
const state = { | |
deleteModalOpen: false, | |
selectedUser: null, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { mount } from 'enzyme'; | |
import { AddUser, mapStateToProps } from '../../../containers/Users/AddUser'; | |
import fetchedGroups from '../../../__mocks__/fetchGroups'; | |
const state = { | |
register: jest.fn(), | |
groups: jest.fn(), | |
}; |
OlderNewer