Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 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,28 @@
  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. +rm -f /etc/default/python-poker-stats
  32. +
  33. +echo SUCCEED
  34. Index: debian/python-poker-stats.cron.monthly
  35. ===================================================================
  36. --- debian/python-poker-stats.cron.monthly (revision 0)
  37. +++ debian/python-poker-stats.cron.monthly (revision 0)
  38. @@ -0,0 +1,38 @@
  39. +#! /bin/sh
  40. +#
  41. +# -*- coding: iso-8859-1 -*-
  42. +#
  43. +# Copyright (C) 2008 Johan Euphrosine <proppy@aminche.com>
  44. +#
  45. +# This program is free software; you can redistribute it and/or modify
  46. +# it under the terms of the GNU General Public License as published by
  47. +# the Free Software Foundation; either version 3 of the License, or
  48. +# (at your option) any later version.
  49. +#
  50. +# This program is distributed in the hope that it will be useful,
  51. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  52. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  53. +# GNU General Public License for more details.
  54. +#
  55. +# You should have received a copy of the GNU General Public License
  56. +# along with this program; if not, write to the Free Software
  57. +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  58. +#
  59. +set -e
  60. +
  61. +RESET_CURRENCY=${RESET_CURRENCY=false}
  62. +MYSQL_USER=${MYSQL_USER=}
  63. +MYSQL_PASSWORD=${MYSQL_PASSWORD=}
  64. +MYSQL_HOST=${MYSQL_HOST=}
  65. +MYSQL_PORT=${MYSQL_PORT=}
  66. +MYSQL_DATABASE=${MYSQL_DATABASE=pythonpokernetwork}
  67. +CURRENCY_SERIAL=${CURRENCY_SERIAL=NO_DEFAULT_CURRENCY_SERIAL}
  68. +
  69. +if [ -f /etc/default/python-poker-stats ] ; then
  70. + . /etc/default/python-poker-stats
  71. +fi
  72. +
  73. +[ $CURRENCY_SERIAL != NO_DEFAULT_CURRENCY_SERIAL ]
  74. +[ $RESET_CURRENCY != false ]
  75. +
  76. +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;"
  77.  
  78. Property changes on: debian/python-poker-stats.cron.monthly
  79. ___________________________________________________________________
  80. Added: svn:executable
  81. + *
  82.  
  83. Index: debian/python-poker-stats.default
  84. ===================================================================
  85. --- debian/python-poker-stats.default (revision 0)
  86. +++ debian/python-poker-stats.default (revision 0)
  87. @@ -0,0 +1,9 @@
  88. +#
  89. +# python-poker-stats default
  90. +#
  91. +
  92. +#
  93. +# Reset user money for CURRENCY_SERIAL
  94. +#
  95. +RESET_CURRENCY=false
  96. +CURRENCY_SERIAL=2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement