def test_create_tours_1(self): Controller.recreate_tables() print("all needed attributes") expected_response = { 'extendedDocs': [], 'name': 'First tour', 'id': 1, 'description': 'This is the first guided tour' } assert expected_response == TourController.create_tour( "First tour", "This is the first guided tour")
def test_create_document(self): Controller.recreate_tables() print("Create a valid document") expected_response = { 'id': 1, 'comments': [], 'user_id': 1, 'publicationDate': None, 'subject': 'Subject1', 'title': 'title', 'refDate': None, 'file': '1.gif', 'originalName': None, 'description': 'a description', 'type': 'type', 'validationStatus': { 'status': Status.Validated, 'doc_id': 1 }, 'visualization': { 'quaternionZ': None, 'positionZ': None, 'positionX': None, 'id': 1, 'quaternionY': None, 'quaternionW': None, 'positionY': None, 'quaternionX': None } } assert expected_response == DocController.create_document( { 'title': 'title', 'subject': 'Subject1', 'type': 'type', 'description': 'a description', 'file': '1.gif', 'user_id': 1, "role": { 'label': 'admin' } }, {'user_id': 1})
'password': '******' }))(UserTest, 'Login with wrong username', True) make_test(lambda: UserController.login({ 'username': '******', 'password': '******' }))(UserTest, 'Login with inexisting username', True) make_test(lambda: UserController.login({ 'username': '', 'password': '******' }))(UserTest, 'Login with empty username', True) make_test(lambda: UserController.login({ 'password': '******' }))(UserTest, 'Login with missing username', True) make_test(lambda: UserController.login({ }))(UserTest, 'Login with all missing fields', True) make_test(lambda: UserController.login({ }))(UserTest, 'Login with all missing fields', True) if __name__ == '__main__': Controller.recreate_tables() UserTest.create_user() UserTest.login() print('\n\n\033[04mSuccessTest\033[01m: ', UserTest.nb_tests_succeed, '/', UserTest.nb_tests, sep='')
def test_document_init(self): Controller.recreate_tables() print("Starting document tests")
def test_read_positions_1(self): Controller.recreate_tables() print("all positions") expected_response = 4 assert expected_response == len(UserRoleController.get_roles())