Skip to content

Commit 38ff1e8

Browse files
committed
parameter which adds links to add/subtract to each user for correction.
1 parent fc6f5d5 commit 38ff1e8

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ Sounds are [CC 0](http://creativecommons.org/publicdomain/zero/1.0/):
4343
* 22.01. - 1.0h - various client code variations, see [sample client](https://github.com/codecop/push-counter-client)
4444
* 05.02. - 3.0h - refresh, JSON content type, copyright, version
4545
* 07.02. - 1.0h - sound
46+
* 16.02. - 1.0h - +/- links

src/main/resources/templates/counts.mustache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
<div class="row">
3232
<div class="col-xs-2">
3333
<b>{{name}}</b>
34+
{{#admin}}
35+
<a href="/record/{{name}}?build=green" target="_blank">+</a>
36+
<a href="/record/{{name}}?build=red" target="_blank">-</a>
37+
{{/admin}}
3438
</div>
3539
<div class="col-xs-1">{{score}}</div>
3640
<div class="col-xs-9">

src/test/java/org/codecop/pushcounter/APITest.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,39 @@ private void assertNoSound(String sessionId) {
172172
statusCode(200). //
173173
body(not(containsString(MP3_NAME)));
174174
}
175+
176+
@Test
177+
void shouldHaveAddButtonOnAdminModeOnly() {
178+
// http://127.0.0.1:4567/?admin=true
179+
180+
givenEntryFor("anyUserForPlus");
181+
182+
// not show for regular
183+
RestAssured. //
184+
given(). //
185+
port(port). //
186+
when(). //
187+
get("/"). //
188+
then(). //
189+
statusCode(200). //
190+
body(not(containsString("\"/record/anyUserForPlus?build=green\""))). //
191+
and(). //
192+
body(not(containsString("\"/record/anyUserForPlus?build=red\"")));
193+
194+
RestAssured. //
195+
given(). //
196+
port(port). //
197+
when(). //
198+
param("admin", true). //
199+
get("/"). //
200+
then(). //
201+
statusCode(200). //
202+
body(containsString("\"/record/anyUserForPlus?build=green\"")). //
203+
and(). //
204+
body(containsString("\"/record/anyUserForPlus?build=red\""));
205+
}
175206

176207
// admin
177-
// TODO admin=true parameter which adds links to add/substract to each user
178208
// TODO admin=true to add new user with form field (user name should also be a form post parameter)
179209

180210
// celebrate the winner

0 commit comments

Comments
 (0)