Advertisement
Guest User

Untitled

a guest
May 9th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. Index: debian/test-python-poker-stats.cron.monthly
  2. ===================================================================
  3. --- debian/test-python-poker-stats.cron.monthly (revision 0)
  4. +++ debian/test-python-poker-stats.cron.monthly (revision 0)
  5. @@ -0,0 +1,27 @@
  6. +set -ex
  7. +
  8. +rm -f /etc/default/python-poker-stats
  9. +
  10. +sh -x ./python-poker-stats.cron.monthly && FAILED # RESET_CURRENCY=false
  11. +RESET_CURRENCY=true sh -x ./python-poker-stats.cron.monthly && FAILED # NO_DEFAULT_CURRENCY_SERIAL
  12. +
  13. +mysql --user=root --database=pythonpokernetwork --execute="DELETE from user2money"
  14. +mysql --user=root --database=pythonpokernetwork --execute="INSERT into user2money VALUES (42, 42, 1000, 1000, 1000);"
  15. +RESET_CURRENCY=true CURRENCY_SERIAL=42 MYSQL_USER=python-poker-net MYSQL_PASSWORD=rjBWccZypin2 MYSQL_DATABASE=pythonpokernetwork MYSQL_HOST=127.0.0.1 MYSQL_PORT=3306 sh -x ./python-poker-stats.cron.monthly
  16. +[ 0 -eq `mysql --user=root --database=pythonpokernetwork --skip-column-names --execute="select COUNT(*) from user2money where currency_serial = 42;"` ] || FAILED
  17. +
  18. +mysql --user=root --database=pythonpokernetwork --execute="DELETE from user2money"
  19. +mysql --user=root --database=pythonpokernetwork --execute="INSERT into user2money VALUES (42, 42, 1000, 1000, 1000);"
  20. +RESET_CURRENCY=true CURRENCY_SERIAL=42 sh -x ./python-poker-stats.cron.monthly
  21. +[ 0 -eq `mysql --user=root --database=pythonpokernetwork --skip-column-names --execute="select COUNT(*) from user2money where currency_serial = 42;"` ] || FAILED
  22. +
  23. +cat << EOF > /etc/default/python-poker-stats
  24. +RESET_CURRENCY=true
  25. +CURRENCY_SERIAL=42
  26. +EOF
  27. +mysql --user=root --database=pythonpokernetwork --execute="DELETE from user2money"
  28. +mysql --user=root --database=pythonpokernetwork --execute="INSERT into user2money VALUES (42, 42, 1000, 1000, 1000);"
  29. +sh -x ./python-poker-stats.cron.monthly
  30. +[ 0 -eq `mysql --user=root --database=pythonpokernetwork --skip-column-names --execute="select COUNT(*) from user2money where currency_serial = 42;"` ] || FAILED
  31. +
  32. +echo SUCCEED
  33. Index: debian/python-poker-stats.cron.monthly
  34. ===================================================================
  35. --- debian/python-poker-stats.cron.monthly (revision 0)
  36. +++ debian/python-poker-stats.cron.monthly (revision 0)
  37. @@ -0,0 +1,38 @@
  38. +#! /bin/sh
  39. +#
  40. +# -*- coding: iso-8859-1 -*-
  41. +#
  42. +# Copyright (C) 2008 Johan Euphrosine <proppy@aminche.com>
  43. +#
  44. +# This program is free software; you can redistribute it and/or modify
  45. +# it under the terms of the GNU General Public License as published by
  46. +# the Free Software Foundation; either version 3 of the License, or
  47. +# (at your option) any later version.
  48. +#
  49. +# This program is distributed in the hope that it will be useful,
  50. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  51. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  52. +# GNU General Public License for more details.
  53. +#
  54. +# You should have received a copy of the GNU General Public License
  55. +# along with this program; if not, write to the Free Software
  56. +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  57. +#
  58. +set -e
  59. +
  60. +RESET_CURRENCY=${RESET_CURRENCY=false}
  61. +MYSQL_USER=${MYSQL_USER=}
  62. +MYSQL_PASSWORD=${MYSQL_PASSWORD=}
  63. +MYSQL_HOST=${MYSQL_HOST=}
  64. +MYSQL_PORT=${MYSQL_PORT=}
  65. +MYSQL_DATABASE=${MYSQL_DATABASE=pythonpokernetwork}
  66. +CURRENCY_SERIAL=${CURRENCY_SERIAL=NO_DEFAULT_CURRENCY_SERIAL}
  67. +
  68. +if [ -f /etc/default/python-poker-stats ] ; then
  69. + . /etc/default/python-poker-stats
  70. +fi
  71. +
  72. +[ $CURRENCY_SERIAL != NO_DEFAULT_CURRENCY_SERIAL ]
  73. +[ $RESET_CURRENCY != false ]
  74. +
  75. +mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD --database=$MYSQL_DATABASE --host=$MYSQL_HOST --port=$MYSQL_PORT --execute="DELETE from user2money where currency_serial = $CURRENCY_SERIAL;"
  76.  
  77. Property changes on: debian/python-poker-stats.cron.monthly
  78. ___________________________________________________________________
  79. Added: svn:executable
  80. + *
  81.  
  82. Index: debian/python-poker-stats.default
  83. ===================================================================
  84. --- debian/python-poker-stats.default (revision 0)
  85. +++ debian/python-poker-stats.default (revision 0)
  86. @@ -0,0 +1,9 @@
  87. +#
  88. +# python-poker-stats default
  89. +#
  90. +
  91. +#
  92. +# Reset user money for CURRENCY_SERIAL
  93. +#
  94. +RESET_CURRENCY=false
  95. +CURRENCY_SERIAL=2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement