From 9d91198c3711e510288afb736b4e4d02d333ce1a Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Wed, 6 Apr 2016 14:11:33 +0200 Subject: [PATCH] reflect api change --- src/app/Entries/EntryForm.vue | 12 +++--- src/app/Entries/UpdateEntry.vue | 1 - src/app/Entries/newEntry.vue | 6 +-- src/app/Index.vue | 4 +- tests/entries.tests.js | 8 ++-- tests/helpers.js | 81 +++++++++-------------------------------- 6 files changed, 31 insertions(+), 81 deletions(-) diff --git a/src/app/Entries/EntryForm.vue b/src/app/Entries/EntryForm.vue index 88a99da..5b56f3d 100644 --- a/src/app/Entries/EntryForm.vue +++ b/src/app/Entries/EntryForm.vue @@ -2,15 +2,15 @@
- -
+
{{ $t('passwordgenerator.length') }} @@ -93,7 +93,7 @@ -
+
{{ $t('passwordgenerator.counter') }} diff --git a/src/app/Entries/UpdateEntry.vue b/src/app/Entries/UpdateEntry.vue index e7d08c3..2a41ad6 100644 --- a/src/app/Entries/UpdateEntry.vue +++ b/src/app/Entries/UpdateEntry.vue @@ -39,7 +39,6 @@ update() { http.entries.update(this.entry) .then(() => { - logging.success(this.$t('entries.entry_update')); }) .catch((err) => { diff --git a/src/app/Entries/newEntry.vue b/src/app/Entries/newEntry.vue index 8855258..32f615c 100644 --- a/src/app/Entries/newEntry.vue +++ b/src/app/Entries/newEntry.vue @@ -41,7 +41,7 @@ data() { return { entry: { - email: '', + login: '', site: '', password: { counter: 1, @@ -56,10 +56,6 @@ }, methods: { create() { - if (this.entry.site === '') { - logging.error(this.$t('entries.site_mandatory')); - return; - } http.entries.create(this.entry) .then(() => { $('#newEntryModal').modal('hide'); diff --git a/src/app/Index.vue b/src/app/Index.vue index b0002d6..116d306 100644 --- a/src/app/Index.vue +++ b/src/app/Index.vue @@ -58,7 +58,7 @@

{{ entry.site }}

- {{ entry.email }} + {{ entry.login }}
@@ -75,7 +75,7 @@ {{ $t('index.previous') }}
-
+
{{ currentPage }} / {{ numberPages }}
diff --git a/tests/entries.tests.js b/tests/entries.tests.js index 2c65c55..2072ea2 100644 --- a/tests/entries.tests.js +++ b/tests/entries.tests.js @@ -23,7 +23,7 @@ suite('entries', () => { ], "length": 12 }, - "email": "guillaume@oslab.fr", + "login": "guillaume@lesspass.com", }; }); @@ -39,7 +39,7 @@ suite('entries', () => { nock('http://localhost/').post('/api/entries/', entry).reply(201, entry); entries.create(entry) .then((newEntry) => { - assert.equal(entry.email, newEntry.email); + assert.equal(entry.login, newEntry.login); done(); }); }); @@ -58,7 +58,7 @@ suite('entries', () => { nock('http://localhost/').get('/api/entries/').query(true).reply(200, {entries: entriesGetAll}); entries.all().then((response) => { assert.equal(200, response.status); - assert.equal(5, response.data.entries.results.length); + assert.equal(entriesGetAll.count, response.data.entries.results.length); done(); }); }); @@ -86,7 +86,7 @@ suite('entries', () => { var updatedEntry = JSON.parse(JSON.stringify(entriesGetOne)); updatedEntry.email = 'test2@lesspass.com'; var headers = {reqheaders: {'Authorization': 'JWT ' + token}}; - nock('http://localhost/', headers).put('/api/entries/d1ff1ae9-bb29-469d-8e5e-8a387f529de0/').reply(200, updatedEntry); + nock('http://localhost/', headers).put(`/api/entries/${updatedEntry.id}/`).reply(200, updatedEntry); entries.update(updatedEntry) .then((entry) => { assert.equal(updatedEntry.email, entry.email); diff --git a/tests/helpers.js b/tests/helpers.js index 235b39c..1af4377 100644 --- a/tests/helpers.js +++ b/tests/helpers.js @@ -14,78 +14,33 @@ after(()=> { }); const entriesGetAll = { - "count": 5, + "count": 3, "next": null, "previous": null, "results": [{ - "id": "d7ef8d1e-b5e3-4227-926b-29f236c49c6b", - "site": "site 1", + "id": "535a439d-49cf-4b32-844f-d367640a0a9b", + "site": "facebook.com", + "login": "test@lesspass.com", "password": {"counter": 1, "settings": ["lowercase", "uppercase", "numbers", "symbols"], "length": 12}, - "title": null, - "username": null, - "email": "test@lesspass.com", - "description": null, - "url": null, - "created": "2016-04-04T12:59:42.815400", - "modified": "2016-04-04T12:59:42.815431" + "created": "2016-04-06T11:34:46.719242", + "modified": "2016-04-06T11:34:46.719265" }, { - "id": "1e532990-66c4-4522-b033-ce6ee13b37c5", - "site": "site 2", - "password": {"counter": 1, "settings": ["lowercase", "uppercase", "numbers", "symbols"], "length": 12}, - "title": null, - "username": null, - "email": "test@lesspass.com", - "description": null, - "url": null, - "created": "2016-04-04T12:59:19.005800", - "modified": "2016-04-04T12:59:19.005821" - }, { - "id": "61dc47cc-9f78-4ad1-acda-61914227b2cd", - "site": "site 3", - "password": {"counter": 1, "settings": ["lowercase", "uppercase", "numbers", "symbols"], "length": 12}, - "title": null, - "username": null, - "email": "test@lesspass.com", - "description": null, - "url": null, - "created": "2016-04-04T08:12:06.686885", - "modified": "2016-04-04T08:12:06.686909" + "id": "a45b8a54-485f-4e8e-a03e-9d2ae169514c", + "site": "twitter.com", + "login": "test@lesspass.com", + "password": {"counter": 10, "settings": ["lowercase", "uppercase", "numbers", "symbols"], "length": 14}, + "created": "2016-04-06T11:32:15.537767", + "modified": "2016-04-06T11:33:46.951174" }, { - "id": "57a3e0ac-08a4-447b-831c-7863896ea210", - "site": "site 4", + "id": "d7fe3061-cb3b-492e-bc1e-b88c79acaa0c", + "site": "lesspass.com", + "login": "test@lesspass.com", "password": {"counter": 1, "settings": ["lowercase", "uppercase", "numbers", "symbols"], "length": 12}, - "title": null, - "username": null, - "email": "test@lesspass.com", - "description": null, - "url": null, - "created": "2016-04-04T08:11:55.130015", - "modified": "2016-04-04T08:11:55.130037" - }, { - "id": "772abd32-5712-48c0-ba81-8a1a3748757e", - "site": "site 5", - "password": {"counter": 1, "settings": ["lowercase", "uppercase", "numbers", "symbols"], "length": 12}, - "title": null, - "username": null, - "email": "test@lesspass.com", - "description": null, - "url": null, - "created": "2016-04-01T19:57:15.738606", - "modified": "2016-04-01T19:57:15.738627" + "created": "2016-04-06T11:27:49.962268", + "modified": "2016-04-06T11:31:05.975255" }] }; export {entriesGetAll}; -var entriesGetOne = { - "id": "d1ff1ae9-bb29-469d-8e5e-8a387f529de0", - "site": "lesspass.com", - "password": {"counter": 1, "settings": ["lowercase", "uppercase", "numbers", "symbols"], "length": 12}, - "title": null, - "username": null, - "email": "test@lesspass.com", - "description": null, - "url": null, - "created": "2016-04-05T16:44:46.210303", - "modified": "2016-04-05T16:44:46.210325" -}; +var entriesGetOne = JSON.parse(JSON.stringify(entriesGetAll.results[0])); export {entriesGetOne}; \ No newline at end of file