Add made tests, db init to readme

This commit is contained in:
Ondřej Fischer 2019-12-09 15:57:50 +01:00
parent 2dbd72bf34
commit 7dd5afe599

114
README.md
View File

@ -169,6 +169,120 @@ It is possible to chain requests: [see doc](https://support.insomnia.rest/articl
`npm install -g snowboard` `npm install -g snowboard`
## Tests made
- add token to db/colnod
- edit token in db/colnod
- delete token from db/colnod
- add subject to colnod
- edit subject in colnod
- delete subject from colnod
- edit same token on both db/colnod (diffrent time)
## First sync expected results
- 2892 tokens updated
- 173 tokens deleted
- 2894 subjects updated
- 117 subjects deleted
## Database inicialization
- Token table
```SQL create
-- Table: public.colnod_token
-- DROP TABLE public.colnod_token;
CREATE TABLE public.colnod_token
(
id character(36) COLLATE pg_catalog."default" NOT NULL,
auth_errors integer DEFAULT 255,
description character varying(255) COLLATE pg_catalog."default",
enabled boolean DEFAULT true,
last_update timestamp without time zone DEFAULT '1970-01-01 00:00:00.001'::timestamp without time zone,
name character varying(255) COLLATE pg_catalog."default",
no_validity boolean DEFAULT true,
time_to_live integer DEFAULT 255,
token_bits integer DEFAULT 32,
token_data character varying(255) COLLATE pg_catalog."default",
token_type character varying(255) COLLATE pg_catalog."default" DEFAULT 'Token'::character varying,
subject_id character(36) COLLATE pg_catalog."default",
last_modified timestamp without time zone NOT NULL,
deleted boolean DEFAULT false,
CONSTRAINT colnod_token_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.colnod_token
OWNER to postgres;
```
- Subject table
```SQL create
-- Table: public.colnod_subject
-- DROP TABLE public.colnod_subject;
CREATE TABLE public.colnod_subject
(
id character(36) COLLATE pg_catalog."default" NOT NULL,
description character varying(255) COLLATE pg_catalog."default",
last_update timestamp without time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default",
pin character varying(255) COLLATE pg_catalog."default",
last_modified timestamp without time zone,
deleted boolean,
CONSTRAINT colnod_subject_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.colnod_subject
OWNER to postgres;
```
- Subject attributes table
```SQL create
-- Table: public.colnod_subject_attribute
-- DROP TABLE public.colnod_subject_attribute;
CREATE TABLE public.colnod_subject_attribute
(
id character varying(255) COLLATE pg_catalog."default" NOT NULL,
attribute_key character varying(255) COLLATE pg_catalog."default",
attribute_value character varying(255) COLLATE pg_catalog."default",
subject_id character(36) COLLATE pg_catalog."default",
CONSTRAINT colnod_subject_attribute_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.colnod_subject_attribute
OWNER to postgres;
```
- Config
```SQL create
-- Table: public.config
-- DROP TABLE public.config;
CREATE TABLE public.config
(
last_sync bigint NOT NULL DEFAULT 0,
CONSTRAINT config_pkey PRIMARY KEY (last_sync)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.config
OWNER to postgres;
```
## Possible checks ## Possible checks
[here](https://gitlab.com/spaceti-app/integrations/acs/colnod-connector/blob/master/doc/possible-checks.md) [here](https://gitlab.com/spaceti-app/integrations/acs/colnod-connector/blob/master/doc/possible-checks.md)