瀏覽代碼

reflect api change

pull/342/head
Guillaume Vincent 8 年之前
父節點
當前提交
9d91198c37
共有 6 個檔案被更改,包括 31 行新增81 行删除
  1. +6
    -6
      src/app/Entries/EntryForm.vue
  2. +0
    -1
      src/app/Entries/UpdateEntry.vue
  3. +1
    -5
      src/app/Entries/newEntry.vue
  4. +2
    -2
      src/app/Index.vue
  5. +4
    -4
      tests/entries.tests.js
  6. +18
    -63
      tests/helpers.js

+ 6
- 6
src/app/Entries/EntryForm.vue 查看文件

@@ -2,15 +2,15 @@
<form id="password-generator-form">
<div class="form-group row">
<div class="col-lg-6 m-t-1">
<label for="pg-email" class="sr-only">
<label for="pg-login" class="sr-only">
{{ $t('passwordgenerator.who_are_you') }}
</label>
<input id="pg-email"
<input id="pg-login"
class="form-control"
type="text"
placeholder="{{ $t('passwordgenerator.who_are_you') }}"
value="{{entry.email}}"
v-model="entry.email"
value="{{entry.login}}"
v-model="entry.login"
autofocus
autocomplete="off"
autocorrect="off"
@@ -79,7 +79,7 @@
<label for="passwordLength" class="sr-only">
{{ $t('passwordgenerator.length') }}
</label>
<div class="input-group input-group-sm">
<div class="input-group">
<span class="input-group-addon" id="passwordLengthAddon">
{{ $t('passwordgenerator.length') }}
</span>
@@ -93,7 +93,7 @@
<label for="passwordCounter" class="sr-only">
{{ $t('passwordgenerator.counter') }}
</label>
<div class="input-group input-group-sm">
<div class="input-group">
<span class="input-group-addon" id="passwordCounterAddon">
{{ $t('passwordgenerator.counter') }}
</span>


+ 0
- 1
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) => {


+ 1
- 5
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');


+ 2
- 2
src/app/Index.vue 查看文件

@@ -58,7 +58,7 @@
<p>{{ entry.site }}</p>
<footer>
<small class="text-muted">
{{ entry.email }}
{{ entry.login }}
</small>
</footer>
</blockquote>
@@ -75,7 +75,7 @@
{{ $t('index.previous') }}
</button>
</div>
<div class="col-xs-4 text-xs-center">
<div class="col-xs-4 text-xs-center" v-if="numberPages > 1">
{{ currentPage }} / {{ numberPages }}
</div>
<div class="col-xs-4 text-xs-right">


+ 4
- 4
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);


+ 18
- 63
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};

Loading…
取消
儲存