gamekey 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9021ba8301abd0b2212bac379f30853727da957
4
- data.tar.gz: 65f3202b5b2a8b46da58317ce73634670f3a2931
3
+ metadata.gz: 5e1811ae91ca0c3a3e8bf367102245dc6966f0e3
4
+ data.tar.gz: b10f545ec4a409351660c5d594ca0178e9ac298d
5
5
  SHA512:
6
- metadata.gz: e9d54d1d3e9c58bfbf10356956cce144916709fbb55c7ec11db49905304d8443281a1f1866ff11aa195a74f2649dfaf7f0dd653399e82d6316c04a1e9cf816ce
7
- data.tar.gz: 50f9540a370b0e27dc43de89e81c9c9e9b6c059e5aa3b58bf966e6f433c2f46b4c185e5a379568c34d1029aba6843e810f017e1db7fc6e1bb5e0492a54663f5a
6
+ metadata.gz: 2c2bb15f1b1ba226d5dd5aa4360b0fbcd3a089f7a82a4f531553e867454c68dcb45996edb5d6fa04d3f63a35114c2d66d9944b09fd056b35b413ee58512820f6
7
+ data.tar.gz: 1a9bfe61b13773a46070d54e13de7f880389f31b8ed534dbfb1bd1cbce7f3000348c892053fdcc4c63ceff3e15c46adbb3316528341c54b38fcecf4e02437770
data/README.md CHANGED
@@ -134,6 +134,10 @@ So you can get all the sources via the following git command.
134
134
 
135
135
  ## Changelog
136
136
 
137
+ ### Version 0.0.3
138
+ POST /user checks now that a password and a user name is provided.
139
+ Thanks again to Jan Lukas Deichmann figuring out this bug (WebTech SoSe 2016).
140
+
137
141
  ### Version 0.0.2
138
142
  POST /game checks now that a secret is provided.
139
143
  Thanks to Jan Lukas Deichmann figuring out this bug (WebTech SoSe 2016).
data/bin/gamekey CHANGED
@@ -9,7 +9,7 @@ require 'gamekey'
9
9
  require 'defaults'
10
10
  require 'reference'
11
11
 
12
- program :version, '0.0.2'
12
+ program :version, Gamekey::VERSION
13
13
  program :description, 'Command to launch, manage and test the gamekey service.'
14
14
  default_command :help
15
15
 
data/lib/gamekey.rb CHANGED
@@ -128,6 +128,16 @@ class GamekeyService
128
128
  mail = params['mail']
129
129
  id = SecureRandom.uuid
130
130
 
131
+ if (name == nil || name.empty?)
132
+ status 400
133
+ return "Bad Request: '#{name}' is not a valid name"
134
+ end
135
+
136
+ if (pwd == nil || pwd.empty?)
137
+ status 400
138
+ return "Bad Request: password must be provided and not be empty"
139
+ end
140
+
131
141
  unless mail =~ Defaults::VALID_EMAIL_REGEX || mail == nil
132
142
  status 400
133
143
  return "Bad Request: '#{mail}' is not a valid email."
@@ -1,3 +1,3 @@
1
1
  module Gamekey
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/reference.rb CHANGED
@@ -42,6 +42,13 @@ class GamekeyReferenceTests
42
42
 
43
43
  uri = URI("#{@host}/user")
44
44
  send = DateTime.now
45
+
46
+ res = Net::HTTP.post_form(uri, 'name' => @user)
47
+ return "#{error('POST', '/user', "PU-0")} Could create user '#{@user}' without password (should return HTTP code 400, was #{res.code})".red unless (res.code == "400")
48
+
49
+ res = Net::HTTP.post_form(uri, 'pwd' => 'secret')
50
+ return "#{error('POST', '/user', "PU-0a")} Could create user without name (should return HTTP code 400, was #{res.code})".red unless (res.code == "400")
51
+
45
52
  res = Net::HTTP.post_form(uri, 'name' => @user, 'pwd' => @pwd)
46
53
 
47
54
  return "#{error('POST', '/user', "PU-1")} Could not create user '#{@user}' (should return HTTP code 200, was #{res.code})".red unless (res.code == "200")
@@ -271,7 +278,7 @@ class GamekeyReferenceTests
271
278
  name = "John Doe #{i}"
272
279
  request.set_form_data({
273
280
  "name" => name,
274
- "pwd" => ""
281
+ "pwd" => "secret"
275
282
  })
276
283
  res = http.request(request)
277
284
  return "#{error('POST', '/user', "SU-1")} Creating user with name '#{name}' failed while stress testing.\n#{res.body}".red unless res.code == "200"
@@ -286,7 +293,7 @@ class GamekeyReferenceTests
286
293
  users.each do |user|
287
294
  delete_user = Net::HTTP::Delete.new("/user/#{user['id']}")
288
295
  delete_user.set_form_data({
289
- "pwd" => ""
296
+ "pwd" => "secret"
290
297
  })
291
298
  res = http.request(delete_user)
292
299
  return "#{error('DELETE', '/user/id', "SU-3")} Deleting user with id '#{user['name']} (#{user['id']})' failed while stress testing.\n#{res.body}".red unless res.code == "200"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamekey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nane Kratzke