Compare commits
merge into: warricksothr:master
warricksothr:development
warricksothr:framework
warricksothr:master
pull from: warricksothr:framework
warricksothr:development
warricksothr:framework
warricksothr:master
15 Commits
45 changed files with 9263 additions and 64 deletions
-
4.gitignore
-
13.gitlab-ci.yml
-
4TODO
-
21administration_client/.gitignore
-
26administration_client/README.md
-
5administration_client/babel.config.js
-
13administration_client/create_config_files.sh
-
81administration_client/package.json
-
BINadministration_client/public/favicon.ico
-
17administration_client/public/index.html
-
29administration_client/src/App.vue
-
BINadministration_client/src/assets/logo.png
-
59administration_client/src/components/HelloWorld.vue
-
12administration_client/src/main.ts
-
23administration_client/src/router.ts
-
13administration_client/src/shims-tsx.d.ts
-
4administration_client/src/shims-vue.d.ts
-
16administration_client/src/store.ts
-
5administration_client/src/views/About.vue
-
18administration_client/src/views/Home.vue
-
12administration_client/tests/unit/HelloWorld.spec.ts
-
40administration_client/tsconfig.json
-
19administration_client/tslint.json
-
8317administration_client/yarn.lock
-
15server/atheneum/api/authentication_api.py
-
8server/atheneum/middleware/authentication_middleware.py
-
16server/atheneum/service/transformation_service.py
-
45server/documentation/api/authentication.rst
-
4server/documentation/api/index.rst
-
24server/documentation/api/user.rst
-
2server/documentation/apidoc-gen.sh
-
9server/documentation/conf.py
-
1server/documentation/index.rst
-
46server/documentation/server/atheneum.api.rst
-
22server/documentation/server/atheneum.middleware.rst
-
22server/documentation/server/atheneum.model.rst
-
49server/documentation/server/atheneum.rst
-
70server/documentation/server/atheneum.service.rst
-
46server/documentation/server/atheneum.utility.rst
-
7server/documentation/server/modules.rst
-
15server/tests/api/test_authentication_api.py
-
22server/tests/api/test_user_api.py
-
46server/tests/conftest.py
-
92server/tests/service/test_authentication_service.py
-
1server/tests/service/test_transformation_service.py
@ -0,0 +1,4 @@ |
|||
Items are ranked from top to bottom for priority |
|||
|
|||
* Administration Web Interface |
|||
* Docker Compose |
@ -0,0 +1,21 @@ |
|||
.DS_Store |
|||
node_modules |
|||
/dist |
|||
|
|||
# local env files |
|||
.env.local |
|||
.env.*.local |
|||
|
|||
# Log files |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
|
|||
# Editor directories and files |
|||
.idea |
|||
.vscode |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
*.sw* |
@ -0,0 +1,26 @@ |
|||
# administration_client |
|||
|
|||
## Project setup |
|||
``` |
|||
yarn install |
|||
``` |
|||
|
|||
### Compiles and hot-reloads for development |
|||
``` |
|||
yarn run serve |
|||
``` |
|||
|
|||
### Compiles and minifies for production |
|||
``` |
|||
yarn run build |
|||
``` |
|||
|
|||
### Lints and fixes files |
|||
``` |
|||
yarn run lint |
|||
``` |
|||
|
|||
### Run your unit tests |
|||
``` |
|||
yarn run test:unit |
|||
``` |
@ -0,0 +1,5 @@ |
|||
module.exports = { |
|||
presets: [ |
|||
'@vue/app' |
|||
] |
|||
} |
@ -0,0 +1,13 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
if [ -z "$NPM_CONFIG_REGISTRY" ] |
|||
then |
|||
echo "No custom registry defined..." |
|||
else |
|||
echo "Creating custom registry configurations..." |
|||
echo "registry \"$NPM_CONFIG_REGISTRY\"" |
|||
echo "registry \"$NPM_CONFIG_REGISTRY\"" >> .npmrc |
|||
echo "registry \"$NPM_CONFIG_REGISTRY\"" >> .yarnrc |
|||
echo "Replacing static yarn registry references in yarn.lock... BUGFIX... revisit with yarn 2+... https://github.com/yarnpkg/yarn/issues/3330" |
|||
find . -name yarn.lock -exec sed -i "s#https://registry.yarnpkg.com#`awk '$1 == "registry" { gsub(/"/,""); print $NF}' .yarnrc`#g" {} \; |
|||
fi |
@ -0,0 +1,81 @@ |
|||
{ |
|||
"name": "atheneum_administration_client", |
|||
"version": "0.1.0", |
|||
"private": true, |
|||
"scripts": { |
|||
"serve": "vue-cli-service serve", |
|||
"build": "vue-cli-service build", |
|||
"lint": "vue-cli-service lint", |
|||
"test:unit": "vue-cli-service test:unit" |
|||
}, |
|||
"dependencies": { |
|||
"vue": "^2.5.17", |
|||
"vue-class-component": "^6.0.0", |
|||
"vue-property-decorator": "^7.0.0", |
|||
"vue-router": "^3.0.1", |
|||
"vuex": "^3.0.1" |
|||
}, |
|||
"devDependencies": { |
|||
"@types/jest": "^23.1.4", |
|||
"@vue/cli-plugin-babel": "^3.0.1", |
|||
"@vue/cli-plugin-typescript": "^3.0.1", |
|||
"@vue/cli-plugin-unit-jest": "^3.0.1", |
|||
"@vue/cli-service": "^3.0.1", |
|||
"@vue/test-utils": "^1.0.0-beta.20", |
|||
"babel-core": "7.0.0-bridge.0", |
|||
"lint-staged": "^7.2.2", |
|||
"node-sass": "^4.9.0", |
|||
"sass-loader": "^7.0.1", |
|||
"ts-jest": "^23.0.0", |
|||
"typescript": "^3.0.0", |
|||
"vue-template-compiler": "^2.5.17" |
|||
}, |
|||
"postcss": { |
|||
"plugins": { |
|||
"autoprefixer": {} |
|||
} |
|||
}, |
|||
"browserslist": [ |
|||
"> 1%", |
|||
"last 2 versions", |
|||
"not ie <= 8" |
|||
], |
|||
"jest": { |
|||
"moduleFileExtensions": [ |
|||
"js", |
|||
"jsx", |
|||
"json", |
|||
"vue", |
|||
"ts", |
|||
"tsx" |
|||
], |
|||
"transform": { |
|||
"^.+\\.vue$": "vue-jest", |
|||
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub", |
|||
"^.+\\.tsx?$": "ts-jest" |
|||
}, |
|||
"moduleNameMapper": { |
|||
"^@/(.*)$": "<rootDir>/src/$1" |
|||
}, |
|||
"snapshotSerializers": [ |
|||
"jest-serializer-vue" |
|||
], |
|||
"testMatch": [ |
|||
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)" |
|||
], |
|||
"testURL": "http://localhost/" |
|||
}, |
|||
"gitHooks": { |
|||
"pre-commit": "lint-staged" |
|||
}, |
|||
"lint-staged": { |
|||
"*.ts": [ |
|||
"vue-cli-service lint", |
|||
"git add" |
|||
], |
|||
"*.vue": [ |
|||
"vue-cli-service lint", |
|||
"git add" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
|||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
|||
<title>administration_client</title> |
|||
</head> |
|||
<body> |
|||
<noscript> |
|||
<strong>We're sorry but Atheneum Administration Client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> |
|||
</noscript> |
|||
<div id="app"></div> |
|||
<!-- built files will be auto injected --> |
|||
</body> |
|||
</html> |
@ -0,0 +1,29 @@ |
|||
<template> |
|||
<div id="app"> |
|||
<div id="nav"> |
|||
<router-link to="/">Home</router-link> | |
|||
<router-link to="/about">About</router-link> |
|||
</div> |
|||
<router-view/> |
|||
</div> |
|||
</template> |
|||
|
|||
<style lang="scss"> |
|||
#app { |
|||
font-family: 'Avenir', Helvetica, Arial, sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
text-align: center; |
|||
color: #2c3e50; |
|||
} |
|||
#nav { |
|||
padding: 30px; |
|||
a { |
|||
font-weight: bold; |
|||
color: #2c3e50; |
|||
&.router-link-exact-active { |
|||
color: #42b983; |
|||
} |
|||
} |
|||
} |
|||
</style> |
After Width: 200 | Height: 200 | Size: 6.7 KiB |
@ -0,0 +1,59 @@ |
|||
<template> |
|||
<div class="hello"> |
|||
<h1>{{ msg }}</h1> |
|||
<p> |
|||
For guide and recipes on how to configure / customize this project,<br> |
|||
check out the |
|||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>. |
|||
</p> |
|||
<h3>Installed CLI Plugins</h3> |
|||
<ul> |
|||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li> |
|||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript" target="_blank" rel="noopener">typescript</a></li> |
|||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest" target="_blank" rel="noopener">unit-jest</a></li> |
|||
</ul> |
|||
<h3>Essential Links</h3> |
|||
<ul> |
|||
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li> |
|||
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li> |
|||
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li> |
|||
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li> |
|||
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li> |
|||
</ul> |
|||
<h3>Ecosystem</h3> |
|||
<ul> |
|||
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li> |
|||
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li> |
|||
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li> |
|||
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li> |
|||
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li> |
|||
</ul> |
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts"> |
|||
import { Component, Prop, Vue } from 'vue-property-decorator'; |
|||
|
|||
@Component |
|||
export default class HelloWorld extends Vue { |
|||
@Prop() private msg!: string; |
|||
} |
|||
</script> |
|||
|
|||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
|||
<style scoped lang="scss"> |
|||
h3 { |
|||
margin: 40px 0 0; |
|||
} |
|||
ul { |
|||
list-style-type: none; |
|||
padding: 0; |
|||
} |
|||
li { |
|||
display: inline-block; |
|||
margin: 0 10px; |
|||
} |
|||
a { |
|||
color: #42b983; |
|||
} |
|||
</style> |
@ -0,0 +1,12 @@ |
|||
import Vue from 'vue'; |
|||
import App from './App.vue'; |
|||
import router from './router'; |
|||
import store from './store'; |
|||
|
|||
Vue.config.productionTip = false; |
|||
|
|||
new Vue({ |
|||
router, |
|||
store, |
|||
render: (h) => h(App), |
|||
}).$mount('#app'); |
@ -0,0 +1,23 @@ |
|||
import Vue from 'vue'; |
|||
import Router from 'vue-router'; |
|||
import Home from './views/Home.vue'; |
|||
|
|||
Vue.use(Router); |
|||
|
|||
export default new Router({ |
|||
routes: [ |
|||
{ |
|||
path: '/', |
|||
name: 'home', |
|||
component: Home, |
|||
}, |
|||
{ |
|||
path: '/about', |
|||
name: 'about', |
|||
// route level code-splitting
|
|||
// this generates a separate chunk (about.[hash].js) for this route
|
|||
// which is lazy-loaded when the route is visited.
|
|||
component: () => import(/* webpackChunkName: "about" */ './views/About.vue'), |
|||
}, |
|||
], |
|||
}); |
@ -0,0 +1,13 @@ |
|||
import Vue, { VNode } from 'vue'; |
|||
|
|||
declare global { |
|||
namespace JSX { |
|||
// tslint:disable no-empty-interface
|
|||
interface Element extends VNode {} |
|||
// tslint:disable no-empty-interface
|
|||
interface ElementClass extends Vue {} |
|||
interface IntrinsicElements { |
|||
[elem: string]: any; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,4 @@ |
|||
declare module '*.vue' { |
|||
import Vue from 'vue'; |
|||
export default Vue; |
|||
} |
@ -0,0 +1,16 @@ |
|||
import Vue from 'vue'; |
|||
import Vuex from 'vuex'; |
|||
|
|||
Vue.use(Vuex); |
|||
|
|||
export default new Vuex.Store({ |
|||
state: { |
|||
|
|||
}, |
|||
mutations: { |
|||
|
|||
}, |
|||
actions: { |
|||
|
|||
}, |
|||
}); |
@ -0,0 +1,5 @@ |
|||
<template> |
|||
<div class="about"> |
|||
<h1>This is an about page</h1> |
|||
</div> |
|||
</template> |
@ -0,0 +1,18 @@ |
|||
<template> |
|||
<div class="home"> |
|||
<img alt="Vue logo" src="../assets/logo.png"> |
|||
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts"> |
|||
import { Component, Vue } from 'vue-property-decorator'; |
|||
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src |
|||
|
|||
@Component({ |
|||
components: { |
|||
HelloWorld, |
|||
}, |
|||
}) |
|||
export default class Home extends Vue {} |
|||
</script> |
@ -0,0 +1,12 @@ |
|||
import { shallowMount } from '@vue/test-utils'; |
|||
import HelloWorld from '@/components/HelloWorld.vue'; |
|||
|
|||
describe('HelloWorld.vue', () => { |
|||
it('renders props.msg when passed', () => { |
|||
const msg = 'new message'; |
|||
const wrapper = shallowMount(HelloWorld, { |
|||
propsData: { msg }, |
|||
}); |
|||
expect(wrapper.text()).toMatch(msg); |
|||
}); |
|||
}); |
@ -0,0 +1,40 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"target": "esnext", |
|||
"module": "esnext", |
|||
"strict": true, |
|||
"jsx": "preserve", |
|||
"importHelpers": true, |
|||
"moduleResolution": "node", |
|||
"experimentalDecorators": true, |
|||
"esModuleInterop": true, |
|||
"allowSyntheticDefaultImports": true, |
|||
"sourceMap": true, |
|||
"baseUrl": ".", |
|||
"types": [ |
|||
"node", |
|||
"jest" |
|||
], |
|||
"paths": { |
|||
"@/*": [ |
|||
"src/*" |
|||
] |
|||
}, |
|||
"lib": [ |
|||
"esnext", |
|||
"dom", |
|||
"dom.iterable", |
|||
"scripthost" |
|||
] |
|||
}, |
|||
"include": [ |
|||
"src/**/*.ts", |
|||
"src/**/*.tsx", |
|||
"src/**/*.vue", |
|||
"tests/**/*.ts", |
|||
"tests/**/*.tsx" |
|||
], |
|||
"exclude": [ |
|||
"node_modules" |
|||
] |
|||
} |
@ -0,0 +1,19 @@ |
|||
{ |
|||
"defaultSeverity": "warning", |
|||
"extends": [ |
|||
"tslint:recommended" |
|||
], |
|||
"linterOptions": { |
|||
"exclude": [ |
|||
"node_modules/**" |
|||
] |
|||
}, |
|||
"rules": { |
|||
"quotemark": [true, "single"], |
|||
"indent": [true, "spaces", 2], |
|||
"interface-name": false, |
|||
"ordered-imports": false, |
|||
"object-literal-sort-keys": false, |
|||
"no-consecutive-blank-lines": false |
|||
} |
|||
} |
8317
administration_client/yarn.lock
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,2 @@ |
|||
#!/usr/bin/env bash |
|||
noglob sphinx-apidoc -o server ../atheneum/ tests/* |
@ -0,0 +1,46 @@ |
|||
atheneum.api package |
|||
==================== |
|||
|
|||
Submodules |
|||
---------- |
|||
|
|||
atheneum.api.authentication\_api module |
|||
--------------------------------------- |
|||
|
|||
.. automodule:: atheneum.api.authentication_api |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.api.decorators module |
|||
------------------------------ |
|||
|
|||
.. automodule:: atheneum.api.decorators |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.api.model module |
|||
------------------------- |
|||
|
|||
.. automodule:: atheneum.api.model |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.api.user\_api module |
|||
----------------------------- |
|||
|
|||
.. automodule:: atheneum.api.user_api |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
|
|||
Module contents |
|||
--------------- |
|||
|
|||
.. automodule:: atheneum.api |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
@ -0,0 +1,22 @@ |
|||
atheneum.middleware package |
|||
=========================== |
|||
|
|||
Submodules |
|||
---------- |
|||
|
|||
atheneum.middleware.authentication\_middleware module |
|||
----------------------------------------------------- |
|||
|
|||
.. automodule:: atheneum.middleware.authentication_middleware |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
|
|||
Module contents |
|||
--------------- |
|||
|
|||
.. automodule:: atheneum.middleware |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
@ -0,0 +1,22 @@ |
|||
atheneum.model package |
|||
====================== |
|||
|
|||
Submodules |
|||
---------- |
|||
|
|||
atheneum.model.user\_model module |
|||
--------------------------------- |
|||
|
|||
.. automodule:: atheneum.model.user_model |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
|
|||
Module contents |
|||
--------------- |
|||
|
|||
.. automodule:: atheneum.model |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
@ -0,0 +1,49 @@ |
|||
atheneum package |
|||
================ |
|||
|
|||
Subpackages |
|||
----------- |
|||
|
|||
.. toctree:: |
|||
|
|||
atheneum.api |
|||
atheneum.middleware |
|||
atheneum.model |
|||
atheneum.service |
|||
atheneum.utility |
|||
|
|||
Submodules |
|||
---------- |
|||
|
|||
atheneum.db module |
|||
------------------ |
|||
|
|||
.. automodule:: atheneum.db |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.default\_settings module |
|||
--------------------------------- |
|||
|
|||
.. automodule:: atheneum.default_settings |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.errors module |
|||
---------------------- |
|||
|
|||
.. automodule:: atheneum.errors |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
|
|||
Module contents |
|||
--------------- |
|||
|
|||
.. automodule:: atheneum |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
@ -0,0 +1,70 @@ |
|||
atheneum.service package |
|||
======================== |
|||
|
|||
Submodules |
|||
---------- |
|||
|
|||
atheneum.service.authentication\_service module |
|||
----------------------------------------------- |
|||
|
|||
.. automodule:: atheneum.service.authentication_service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.service.patch\_service module |
|||
-------------------------------------- |
|||
|
|||
.. automodule:: atheneum.service.patch_service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.service.role\_service module |
|||
------------------------------------- |
|||
|
|||
.. automodule:: atheneum.service.role_service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.service.transformation\_service module |
|||
----------------------------------------------- |
|||
|
|||
.. automodule:: atheneum.service.transformation_service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.service.user\_service module |
|||
------------------------------------- |
|||
|
|||
.. automodule:: atheneum.service.user_service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.service.user\_token\_service module |
|||
-------------------------------------------- |
|||
|
|||
.. automodule:: atheneum.service.user_token_service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.service.validation\_service module |
|||
------------------------------------------- |
|||
|
|||
.. automodule:: atheneum.service.validation_service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
|
|||
Module contents |
|||
--------------- |
|||
|
|||
.. automodule:: atheneum.service |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
@ -0,0 +1,46 @@ |
|||
atheneum.utility package |
|||
======================== |
|||
|
|||
Submodules |
|||
---------- |
|||
|
|||
atheneum.utility.authentication\_utility module |
|||
----------------------------------------------- |
|||
|
|||
.. automodule:: atheneum.utility.authentication_utility |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.utility.json\_utility module |
|||
------------------------------------- |
|||
|
|||
.. automodule:: atheneum.utility.json_utility |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.utility.pagination\_utility module |
|||
------------------------------------------- |
|||
|
|||
.. automodule:: atheneum.utility.pagination_utility |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
atheneum.utility.session\_utility module |
|||
---------------------------------------- |
|||
|
|||
.. automodule:: atheneum.utility.session_utility |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
|||
|
|||
|
|||
Module contents |
|||
--------------- |
|||
|
|||
.. automodule:: atheneum.utility |
|||
:members: |
|||
:undoc-members: |
|||
:show-inheritance: |
@ -0,0 +1,7 @@ |
|||
Atheneum Server API |
|||
=================== |
|||
|
|||
.. toctree:: |
|||
:maxdepth: 4 |
|||
|
|||
atheneum |
@ -0,0 +1,92 @@ |
|||
from datetime import datetime, timedelta |
|||
|
|||
import pytest |
|||
from mock import patch, MagicMock |
|||
from nacl.exceptions import InvalidkeyError |
|||
|
|||
from atheneum import errors |
|||
from atheneum.model import User, UserToken |
|||
from atheneum.service.authentication_service import ( |
|||
validate_password_strength, |
|||
is_valid_token, |
|||
is_valid_password |
|||
) |
|||
|
|||
service_module = 'atheneum.service.authentication_service' |
|||
|
|||
|
|||
def test_validate_password_strength_happy_path(): |
|||
valid_password = "HorseStapleBattery9" |
|||
assert valid_password == validate_password_strength(valid_password) |
|||
|
|||
|
|||
def test_validate_password_strength_length_failure(): |
|||
invalid_password = "TooShor" |
|||
|
|||
with pytest.raises(errors.ValidationError) as e_info: |
|||
error = e_info |
|||
validate_password_strength(invalid_password) |
|||
|
|||
assert error is not None |
|||
|
|||
|
|||
def test_validate_password_strength_uppercase_failure(): |
|||
invalid_password = "NOUPPERCASE9" |
|||
|
|||
with pytest.raises(errors.ValidationError) as e_info: |
|||
error = e_info |
|||
validate_password_strength(invalid_password) |
|||
|
|||
assert error is not None |
|||
|
|||
|
|||
def test_validate_password_strength_lowercase_failure(): |
|||
invalid_password = "NOLOWERCASE9" |
|||
|
|||
with pytest.raises(errors.ValidationError) as e_info: |
|||
error = e_info |
|||
validate_password_strength(invalid_password) |
|||
|
|||
assert error is not None |
|||
|
|||
|
|||
def test_validate_password_strength_number_failure(): |
|||
invalid_password = "NoNumber" |
|||
|
|||
with pytest.raises(errors.ValidationError) as e_info: |
|||
error = e_info |
|||
validate_password_strength(invalid_password) |
|||
|
|||
assert error is not None |
|||
|
|||
|
|||
@patch(service_module + '.pwhash.verify') |
|||
def test_is_valid_password_invalid_key_error( |
|||
mock_pwhash_verify: MagicMock): |
|||
user = User() |
|||
user.password_hash = '' |
|||
mock_pwhash_verify.side_effect = InvalidkeyError() |
|||
assert not is_valid_password(user, '') |
|||
|
|||
|
|||
def test_is_valid_token_happy_path(): |
|||
user_token = UserToken() |
|||
user_token.enabled = True |
|||
assert is_valid_token(user_token) |
|||
|
|||
|
|||
def test_is_valid_token_no_token(): |
|||
assert not is_valid_token(None) |
|||
|
|||
|
|||
def test_is_valid_token_disabled(): |
|||
user_token = UserToken() |
|||
user_token.enabled = False |
|||
assert not is_valid_token(user_token) |
|||
|
|||
|
|||
def test_is_valid_token_expired(): |
|||
user_token = UserToken() |
|||
user_token.enabled = True |
|||
user_token.expiration_time = datetime.now() - timedelta(weeks=1) |
|||
assert not is_valid_token(user_token) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue