Browse Source

Merge branch 'master' of github.com:jbiason/presentations

master
Julio Biason 6 years ago
parent
commit
8c7638923c
  1. 5
      .gitignore
  2. BIN
      _images/bdd-behave.png
  3. BIN
      _images/bdd-robot.png
  4. BIN
      _images/bdd.jpg
  5. BIN
      _images/cleancode.jpg
  6. BIN
      _images/cleancode_dontbeadick.jpg
  7. BIN
      _images/ff_acorns_python.png
  8. BIN
      _images/ff_acorns_state.png
  9. BIN
      _images/ff_broadcast0.png
  10. BIN
      _images/ff_broadcast1.png
  11. BIN
      _images/ff_capacity0.png
  12. BIN
      _images/ff_capacity1.png
  13. BIN
      _images/ff_capacity2.png
  14. BIN
      _images/ff_dayone.jpg
  15. BIN
      _images/ff_daytwo.jpg
  16. BIN
      _images/ff_exactlyonce0.png
  17. BIN
      _images/ff_exactlyonce1.png
  18. BIN
      _images/ff_exactlyonce2.png
  19. BIN
      _images/ff_exactlyonce3.png
  20. BIN
      _images/ff_flip60.png
  21. BIN
      _images/ff_flip61.png
  22. BIN
      _images/ff_flip62.png
  23. BIN
      _images/ff_flip63.png
  24. BIN
      _images/ff_flip64.png
  25. BIN
      _images/ff_flip65.png
  26. BIN
      _images/ff_flip66.png
  27. BIN
      _images/ff_flip67.png
  28. BIN
      _images/ff_harness0.png
  29. BIN
      _images/ff_harness1.png
  30. BIN
      _images/ff_logo.png
  31. BIN
      _images/ff_lyft.png
  32. BIN
      _images/ff_map.png
  33. BIN
      _images/ff_mesos.png
  34. BIN
      _images/ff_migration0.png
  35. BIN
      _images/ff_migration1.png
  36. BIN
      _images/ff_migration2.png
  37. BIN
      _images/ff_migration3.png
  38. BIN
      _images/ff_migration4.png
  39. BIN
      _images/ff_monitoring0.png
  40. BIN
      _images/ff_monitoring1.png
  41. BIN
      _images/ff_monitoring2.png
  42. BIN
      _images/ff_monitoring3.png
  43. BIN
      _images/ff_monitoring4.png
  44. BIN
      _images/ff_monitoring5.png
  45. BIN
      _images/ff_monitoring6.png
  46. BIN
      _images/ff_pravega.png
  47. BIN
      _images/ff_sherlock.jpg
  48. BIN
      _images/ff_sherlock_policy.png
  49. BIN
      _images/ff_sql.png
  50. BIN
      _images/ff_state0.png
  51. BIN
      _images/ff_state1.png
  52. BIN
      _images/ff_state2.png
  53. BIN
      _images/ff_state3.png
  54. BIN
      _images/ff_state4.png
  55. BIN
      _images/ff_state5.png
  56. BIN
      _images/ff_state6.png
  57. BIN
      _images/ff_watermark1.png
  58. BIN
      _images/ff_watermark2.png
  59. BIN
      _images/ff_watermark3.png
  60. BIN
      _images/ff_watermark4.png
  61. BIN
      _images/ff_watermark5.png
  62. BIN
      _images/ff_watermarks0.png
  63. BIN
      _images/sphinx_awesome.png
  64. BIN
      _images/sphinx_cool.png
  65. BIN
      _images/sphinx_logo.jpg
  66. BIN
      _images/sphinx_sample.png
  67. BIN
      _images/sphinx_source_automodule.png
  68. BIN
      _images/sphinx_updated_about.png
  69. BIN
      _images/sphinx_updated_index.png
  70. BIN
      _images/unclephil-continuous.gif
  71. BIN
      _images/unclephil-flinkpipeline.png
  72. BIN
      _images/unclephil-flinkpipelinereal.png
  73. BIN
      _images/unclephil-kafka.png
  74. BIN
      _images/unclephil-kafkaflink.png
  75. BIN
      _images/unclephil-mrbanks.gif
  76. BIN
      _images/unclephil-nonstop.gif
  77. BIN
      _images/unclephil-onemorething.jpg
  78. BIN
      _images/unclephil-out.gif
  79. BIN
      _images/unclephil-step0.png
  80. BIN
      _images/unclephil-step1.png
  81. BIN
      _images/unclephil-step10.png
  82. BIN
      _images/unclephil-step2.png
  83. BIN
      _images/unclephil-step3.png
  84. BIN
      _images/unclephil-step4.png
  85. BIN
      _images/unclephil-step5.png
  86. BIN
      _images/unclephil-step6.png
  87. BIN
      _images/unclephil-step7.png
  88. BIN
      _images/unclephil-step8.png
  89. BIN
      _images/unclephil-step9.png
  90. BIN
      _images/unclephil-time.jpg
  91. BIN
      _images/unclephil-victory.gif
  92. BIN
      _images/unclephil.jpg
  93. 270
      _sources/mr-banks/unclephil-flinkpipelinereal.dot
  94. 1
      _sources/mr-banks/unclephil-steps-drawio.xml
  95. 25
      _sources/python-bdd/TestingSource.py
  96. 24
      _sources/python-bdd/example.robot
  97. 7
      _sources/python-bdd/features/example.feature
  98. 1
      _sources/python-bdd/features/mainsource.py
  99. 34
      _sources/python-bdd/features/steps/example_steps.py
  100. 100
      _sources/python-bdd/mainsource.py
  101. Some files were not shown because too many files have changed in this diff Show More

5
.gitignore vendored

@ -1,3 +1,8 @@
*.sw?
.DS_Store
index.json
*.pyc
*.xml
report.html
log.html
*.pdf

BIN
_images/bdd-behave.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
_images/bdd-robot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
_images/bdd.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
_images/cleancode.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
_images/cleancode_dontbeadick.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
_images/ff_acorns_python.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
_images/ff_acorns_state.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

BIN
_images/ff_broadcast0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
_images/ff_broadcast1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
_images/ff_capacity0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
_images/ff_capacity1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

BIN
_images/ff_capacity2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

BIN
_images/ff_dayone.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
_images/ff_daytwo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

BIN
_images/ff_exactlyonce0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
_images/ff_exactlyonce1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
_images/ff_exactlyonce2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
_images/ff_exactlyonce3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
_images/ff_flip60.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
_images/ff_flip61.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

BIN
_images/ff_flip62.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
_images/ff_flip63.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
_images/ff_flip64.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
_images/ff_flip65.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

BIN
_images/ff_flip66.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

BIN
_images/ff_flip67.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

BIN
_images/ff_harness0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
_images/ff_harness1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
_images/ff_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
_images/ff_lyft.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

BIN
_images/ff_map.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

BIN
_images/ff_mesos.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
_images/ff_migration0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
_images/ff_migration1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
_images/ff_migration2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

BIN
_images/ff_migration3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
_images/ff_migration4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
_images/ff_monitoring0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
_images/ff_monitoring1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
_images/ff_monitoring2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
_images/ff_monitoring3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
_images/ff_monitoring4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
_images/ff_monitoring5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
_images/ff_monitoring6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
_images/ff_pravega.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
_images/ff_sherlock.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

BIN
_images/ff_sherlock_policy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
_images/ff_sql.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
_images/ff_state0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
_images/ff_state1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
_images/ff_state2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
_images/ff_state3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
_images/ff_state4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
_images/ff_state5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
_images/ff_state6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
_images/ff_watermark1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
_images/ff_watermark2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
_images/ff_watermark3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
_images/ff_watermark4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
_images/ff_watermark5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
_images/ff_watermarks0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
_images/sphinx_awesome.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
_images/sphinx_cool.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
_images/sphinx_logo.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
_images/sphinx_sample.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
_images/sphinx_source_automodule.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
_images/sphinx_updated_about.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
_images/sphinx_updated_index.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
_images/unclephil-continuous.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
_images/unclephil-flinkpipeline.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
_images/unclephil-flinkpipelinereal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

BIN
_images/unclephil-kafka.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
_images/unclephil-kafkaflink.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
_images/unclephil-mrbanks.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 KiB

BIN
_images/unclephil-nonstop.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 KiB

BIN
_images/unclephil-onemorething.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
_images/unclephil-out.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
_images/unclephil-step0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
_images/unclephil-step1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
_images/unclephil-step10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
_images/unclephil-step2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
_images/unclephil-step3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
_images/unclephil-step4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
_images/unclephil-step5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
_images/unclephil-step6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
_images/unclephil-step7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
_images/unclephil-step8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
_images/unclephil-step9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
_images/unclephil-time.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

BIN
_images/unclephil-victory.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
_images/unclephil.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

270
_sources/mr-banks/unclephil-flinkpipelinereal.dot

@ -0,0 +1,270 @@
digraph UnclePhil {
kafka [color=gray, label="Kafka"];
selector1 [label="Selector"];
selector2 [label="Selector"];
selector3 [label="Selector"];
selector4 [label="Selector"];
selector5 [label="Selector"];
selector6 [label="Selector"];
selector7 [label="Selector"];
selector8 [label="Selector"];
selector9 [label="Selector"];
selector10 [label="Selector"];
selector11 [label="Selector"];
selector12 [label="Selector"];
process1 [label="ProcessMessages"];
process2 [label="ProcessMessages"];
process3 [label="ProcessMessages"];
process4 [label="ProcessMessages"];
process5 [label="ProcessMessages"];
process6 [label="ProcessMessages"];
process7 [label="ProcessMessages"];
process8 [label="ProcessMessages"];
process9 [label="ProcessMessages"];
process10 [label="ProcessMessages"];
process11 [label="ProcessMessages"];
process12 [label="ProcessMessages"];
splitter1 [label="MessageSpliter"];
splitter2 [label="MessageSpliter"];
splitter3 [label="MessageSpliter"];
splitter4 [label="MessageSpliter"];
splitter5 [label="MessageSpliter"];
splitter6 [label="MessageSpliter"];
splitter7 [label="MessageSpliter"];
splitter8 [label="MessageSpliter"];
splitter9 [label="MessageSpliter"];
splitter10 [label="MessageSpliter"];
splitter11 [label="MessageSpliter"];
splitter12 [label="MessageSpliter"];
extract1 [label="MetricExtractor"];
extract2 [label="MetricExtractor"];
extract3 [label="MetricExtractor"];
extract4 [label="MetricExtractor"];
extract5 [label="MetricExtractor"];
extract6 [label="MetricExtractor"];
extract7 [label="MetricExtractor"];
extract8 [label="MetricExtractor"];
extract9 [label="MetricExtractor"];
extract10 [label="MetricExtractor"];
extract11 [label="MetricExtractor"];
extract12 [label="MetricExtractor"];
keyby [label="keyBy/Hash"];
window1 [label="Window"];
window2 [label="Window"];
window3 [label="Window"];
window4 [label="Window"];
window5 [label="Window"];
window6 [label="Window"];
window7 [label="Window"];
window8 [label="Window"];
window9 [label="Window"];
window10 [label="Window"];
window11 [label="Window"];
window12 [label="Window"];
reduce1 [label="Reduce"];
reduce2 [label="Reduce"];
reduce3 [label="Reduce"];
reduce4 [label="Reduce"];
reduce5 [label="Reduce"];
reduce6 [label="Reduce"];
reduce7 [label="Reduce"];
reduce8 [label="Reduce"];
reduce9 [label="Reduce"];
reduce10 [label="Reduce"];
reduce11 [label="Reduce"];
reduce12 [label="Reduce"];
sink1 [label="Sink"];
sink2 [label="Sink"];
sink3 [label="Sink"];
sink4 [label="Sink"];
sink5 [label="Sink"];
sink6 [label="Sink"];
sink7 [label="Sink"];
sink8 [label="Sink"];
sink9 [label="Sink"];
sink10 [label="Sink"];
sink11 [label="Sink"];
sink12 [label="Sink"];
kafka -> selector1;
kafka -> selector2;
kafka -> selector3;
kafka -> selector4;
kafka -> selector5;
kafka -> selector6;
kafka -> selector7;
kafka -> selector8;
kafka -> selector9;
kafka -> selector10;
kafka -> selector11;
kafka -> selector12;
selector1 -> process1;
selector2 -> process2;
selector3 -> process3;
selector4 -> process4;
selector5 -> process5;
selector6 -> process6;
selector7 -> process7;
selector8 -> process8;
selector9 -> process9;
selector10 -> process10;
selector11 -> process11;
selector12 -> process12;
process1 -> splitter1;
process2 -> splitter2;
process3 -> splitter3;
process4 -> splitter4;
process5 -> splitter5;
process6 -> splitter6;
process7 -> splitter7;
process8 -> splitter8;
process9 -> splitter9;
process10 -> splitter10;
process11 -> splitter11;
process12 -> splitter12;
splitter1 -> extract1;
splitter1 -> extract1;
splitter1 -> extract1;
splitter2 -> extract2;
splitter2 -> extract2;
splitter2 -> extract2;
splitter3 -> extract3;
splitter3 -> extract3;
splitter3 -> extract3;
splitter4 -> extract4;
splitter4 -> extract4;
splitter4 -> extract4;
splitter5 -> extract5;
splitter5 -> extract5;
splitter5 -> extract5;
splitter6 -> extract6;
splitter6 -> extract6;
splitter6 -> extract6;
splitter7 -> extract7;
splitter7 -> extract7;
splitter7 -> extract7;
splitter8 -> extract8;
splitter8 -> extract8;
splitter8 -> extract8;
splitter9 -> extract9;
splitter9 -> extract9;
splitter9 -> extract9;
splitter10 -> extract10;
splitter10 -> extract10;
splitter10 -> extract10;
splitter11 -> extract11;
splitter11 -> extract11;
splitter11 -> extract11;
splitter12 -> extract12;
splitter12 -> extract12;
splitter12 -> extract12;
extract1 -> keyby;
extract1 -> keyby;
extract1 -> keyby;
extract2 -> keyby;
extract2 -> keyby;
extract2 -> keyby;
extract3 -> keyby;
extract3 -> keyby;
extract3 -> keyby;
extract4 -> keyby;
extract4 -> keyby;
extract4 -> keyby;
extract5 -> keyby;
extract5 -> keyby;
extract5 -> keyby;
extract6 -> keyby;
extract6 -> keyby;
extract6 -> keyby;
extract7 -> keyby;
extract7 -> keyby;
extract7 -> keyby;
extract8 -> keyby;
extract8 -> keyby;
extract8 -> keyby;
extract9 -> keyby;
extract9 -> keyby;
extract9 -> keyby;
extract10 -> keyby;
extract10 -> keyby;
extract10 -> keyby;
extract11 -> keyby;
extract11 -> keyby;
extract11 -> keyby;
extract12 -> keyby;
extract12 -> keyby;
extract12 -> keyby;
keyby -> window1;
keyby -> window2;
keyby -> window3;
keyby -> window4;
keyby -> window5;
keyby -> window6;
keyby -> window7;
keyby -> window8;
keyby -> window9;
keyby -> window10;
keyby -> window11;
keyby -> window12;
window1 -> reduce1;
window2 -> reduce2;
window3 -> reduce3;
window4 -> reduce4;
window5 -> reduce5;
window6 -> reduce6;
window7 -> reduce7;
window8 -> reduce8;
window9 -> reduce9;
window10 -> reduce10;
window11 -> reduce11;
window12 -> reduce12;
reduce1 -> sink1;
reduce2 -> sink2;
reduce3 -> sink3;
reduce4 -> sink4;
reduce5 -> sink5;
reduce6 -> sink6;
reduce7 -> sink7;
reduce8 -> sink8;
reduce9 -> sink9;
reduce10 -> sink10;
reduce11 -> sink11;
reduce12 -> sink12;
}

1
_sources/mr-banks/unclephil-steps-drawio.xml

@ -0,0 +1 @@
<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0" version="8.5.0" editor="www.draw.io" type="device"><diagram id="7fd0e512-99a9-914d-b755-72f1f563e955" name="Page-1">5Zpdb5swFIZ/DbcT2BDCZZt1282kSb1Yd+mBC1YNjhynSffrZ8Dmy0RCFTCPchN8bPzxnFfHPgQHHvLrV46O2XeWYOoAN7k68LMDgAfgXv6UlrfastuHtSHlJFGNWsMj+YOV0VXWM0nwqddQMEYFOfaNMSsKHIueDXHOLv1mz4z2Rz2iFBuGxxhR0/qTJCKrrfvAbe3fMEkzPbLnqprfKH5JOTsXajwHwOfqqqtzpPtS7U8ZStilY4IPDjxwxkR9l18PmJZsNbb6uS83apt5c1yIKQ8oP70iesZ6xtW8xJtmUa0Gl+1dB95fMiLw4xHFZe1Fel/aMpFTWfLkbcxyEqv7k+DsBR8YZbzqCUbV1dRoslBa1DQwF/h6cyleA0gKD7McC/4mm6gHfDeoH1GaCxXiS+vASJmyru+gMiKlmbTpueUmbxS6cYyRgdGTq7rTqujQlOsTfWR9TAUrZMv7Z0LpwIQoSQtZjCUPLO33JS0iNXunKnKSJOUwoz7qe7HrphnQw6CPfmei90fQgxnIe952FQzcFSXsge2ChHBNkNAMBv4HDgZetGI08E32wQdmD8GK7AOT/e4Ds/eDFdnvFgre7ljwdqvLCN4zcdSMbp8lmn2xi9GfA2O4WYzeyFliOY5LpRUWcPTX5GjmFZvhuF+Row6xG+QIRnb45TgulWxZwHHNfUZj2yBHuOY+A8xUazMc19xngJk2bYbjqvuMmQJthaO/6j4z4RyOi+SufNMvSzFFp1PJycwou1DwlYinzv2vEuynoCwVcoJPinNVaOvqgXFi/GEwACknx848bjPfyiYQT7Fqth/n3QEajPDUNo4pEuS1P4sxyGqEH4zI+bXuBIPzVzDwUz179VTrKrOjcNCRO+ioXrLRUeXzZtnTZDAhjbBcBqFlMmj6Ud6L3qmC0B2oAAaLqWBCEmS5CvamCrwb0fffyMB48W2hDvQU/2MdRJZHAy+cSQZgt5wMJuSgdstA78T2hoPmOwybw8GEHNpyHegvW+zVwXsPiWvGgwnvACzXAbBeB3MdE5fUwYR3GJbrAI7oANikAzjXMXFJHUx4B2O5DnzrdTDXORFGy+lgwl/ilusgMHVgVbrgz3VMnE8Gsth+PFs3b79Qhg9/AQ==</diagram></mxfile>

25
_sources/python-bdd/TestingSource.py

@ -0,0 +1,25 @@
import mainsource
class TestingSource(object):
def __init__(self):
self.username = None
self.password = None
self.last_exception = None
def set_username(self, username):
self.username = username
def set_password(self, password):
self.password = password
def create_user(self):
try:
mainsource.create_user(self.username, self.password)
except mainsource.UserCreationError as exc:
self.last_exception = exc
def is_invalid_password(self):
return (self.last_exception and
isinstance(self.last_exception,
mainsource.PasswordIsNotStrongEnough))

24
_sources/python-bdd/example.robot

@ -0,0 +1,24 @@
*** Settings ***
Library TestingSource.py
*** Test Cases ***
Invalid password
Given that I have a username foo
And that I have a password test123
When I try to create a user
Then I should get an error of invalid password
*** Keywords ***
That I have a username
[Arguments] ${username}
set username ${username}
That I have a password
[Arguments] ${password}
Set password ${password}
I try to create a user
Create user
I should get an error of invalid password
Is invalid password

7
_sources/python-bdd/features/example.feature

@ -0,0 +1,7 @@
Feature: Testing passwords
Scenario: Invalid password
Given that I have a username foo
And that I have a password test123
When I try to create an user
Then I should get an error of invalid password

1
_sources/python-bdd/features/mainsource.py

@ -0,0 +1 @@
../mainsource.py

34
_sources/python-bdd/features/steps/example_steps.py

@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
"""Behave steps."""
import behave
import mainsource
@behave.given("that I have a username {name}")
def set_username(context, name):
context.username = name
return
@behave.given("that I have a password {password}")
def set_password(context, password):
context.password = password
return
@behave.when("I try to create an user")
def create_user(context):
try:
mainsource.create_user(context.username, context.password)
except mainsource.UserCreationError as exc:
context.last_exception = exc
return
@behave.then("I should get an error of invalid password")
def is_invalid_password(context):
assert hasattr(context, 'last_exception')
assert isinstance(context.last_exception,
mainsource.PasswordIsNotStrongEnough)

100
_sources/python-bdd/mainsource.py

@ -0,0 +1,100 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""This is a sample code that simulates a user being created."""
from __future__ import print_function
import argparse
import json
from collections import Counter
from unicodedata import category
LOWERCASE_CHARS = "Ll"
UPCASE_CHARS = "Lu"
NUMBERS = "Nd"
class UserCreationError(Exception):
"""Base class for all exceptions in this module."""
pass
class PasswordIsNotStrongEnough(UserCreationError):
"""The password used is not strong enough."""
pass
class UserAlreadyExists(UserCreationError):
"""The user already exists in the database."""
pass
def password_is_strong(password):
"""Check if the password have enough strength."""
number_of = Counter(category(ch) for ch in password)
return (number_of[LOWERCASE_CHARS] >= 1 and
number_of[UPCASE_CHARS] >= 2 and
number_of[NUMBERS] >= 1 and
len(password) >= 12)
def get_users():
"""Retrieve the list of users in the system."""
data = {}
try:
with open('users.json') as origin:
data = json.load(origin)
except IOError:
# File does not exist, so we just assume it's empty
pass
return data
def save_users(user_list):
"""Save the user list back to the 'database'."""
with open('users.json', 'w') as target:
json.dump(user_list, target)
return
def create_user(user, password):
"""'Create' and user."""
if not password_is_strong(password.decode('utf-8')):
raise PasswordIsNotStrongEnough
users = get_users()
if user in users:
raise UserAlreadyExists
users[user] = password
save_users(users)
return
def main():
"""Expose the functions back in command line options."""
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--user',
dest='user',
help='Username to be created',
required=True)
parser.add_argument('-p', '--password',
dest='password',
help='Password for the user',
required=True)
args = parser.parse_args()
try:
create_user(args.user, args.password)
except PasswordIsNotStrongEnough:
print("That password is not strong enough")
except UserAlreadyExists:
print("Username already used")
else:
print("User created")
return
if __name__ == "__main__":
main()

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save