voteamerica / backend

MIT License
7 stars 17 forks source link

Db changes plus development and test support for operator page users #210

Closed jkbits1 closed 6 years ago

jkbits1 commented 6 years ago

Changes tb_user.admin to tb_user.is_admin

Docker environments for fullstack development, local testing and Travis have an environment variable JWT_TOKEN with a test key. An admin and non-admin user are added automatically to these docker environments.

Operator page tests are added to the existing nightwatch tests and these are used by Travis. There are checks for an invalid user, a user without admin permission and an admin user, to ensure each user only can access the correct routes.

NOTE: the password mentioned in README.md below is for VNC viewer (for watching locally-run tests) and is not related to JWT in any way

dmilet commented 6 years ago

@jkbits1

column is renamed on DO VM

LIVE=> \d+ carpoolvote.tb_user; Table "carpoolvote.tb_user" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description -------------------+------------------------+-----------+----------+-------------------------------+----------+--------------+------------- UUID | character varying(50) | | not null | carpoolvote.gen_random_uuid() | extended | | email | character varying(250) | | not null | | extended | | username | character varying(250) | | not null | | extended | | password | character varying(250) | | not null | | extended | | UUID_organization | character varying(50) | | | | extended | | is_admin | boolean | | not null | false | plain | | Indexes: "user_pk" PRIMARY KEY, btree ("UUID") Foreign-key constraints: "user_uuid_organization_fkey" FOREIGN KEY ("UUID_organization") REFERENCES carpoolvote.organization("UUID") ON DELETE CASCADE

jkbits1 commented 6 years ago

@dmilet thanks for updating the DO, that's great 👍 I've just merged a patch #211 as my update to the front-end earlier caused the new operator page tests to fail