Showing
6 changed files
with
227 additions
and
0 deletions
.gitignore
0 → 100755
1 | +# Byte-compiled / optimized / DLL files | ||
2 | +__pycache__/ | ||
3 | +*.py[cod] | ||
4 | +*$py.class | ||
5 | + | ||
6 | +# C extensions | ||
7 | +*.so | ||
8 | + | ||
9 | +# Distribution / packaging | ||
10 | +.Python | ||
11 | +env/ | ||
12 | +build/ | ||
13 | +develop-eggs/ | ||
14 | +dist/ | ||
15 | +downloads/ | ||
16 | +eggs/ | ||
17 | +.eggs/ | ||
18 | +lib/ | ||
19 | +lib64/ | ||
20 | +parts/ | ||
21 | +sdist/ | ||
22 | +var/ | ||
23 | +*.egg-info/ | ||
24 | +.installed.cfg | ||
25 | +*.egg | ||
26 | + | ||
27 | +# PyInstaller | ||
28 | +# Usually these files are written by a python script from a template | ||
29 | +# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
30 | +*.manifest | ||
31 | +*.spec | ||
32 | + | ||
33 | +# Installer logs | ||
34 | +pip-log.txt | ||
35 | +pip-delete-this-directory.txt | ||
36 | + | ||
37 | +# Unit test / coverage reports | ||
38 | +htmlcov/ | ||
39 | +.tox/ | ||
40 | +.coverage | ||
41 | +.coverage.* | ||
42 | +.cache | ||
43 | +nosetests.xml | ||
44 | +coverage.xml | ||
45 | +*,cover | ||
46 | +.hypothesis/ | ||
47 | + | ||
48 | +# Translations | ||
49 | +*.mo | ||
50 | +*.pot | ||
51 | + | ||
52 | +# Django stuff: | ||
53 | +*.log | ||
54 | +local_settings.py | ||
55 | + | ||
56 | +# Flask stuff: | ||
57 | +instance/ | ||
58 | +.webassets-cache | ||
59 | + | ||
60 | +# Scrapy stuff: | ||
61 | +.scrapy | ||
62 | + | ||
63 | +# Sphinx documentation | ||
64 | +docs/_build/ | ||
65 | + | ||
66 | +# PyBuilder | ||
67 | +target/ | ||
68 | + | ||
69 | +# IPython Notebook | ||
70 | +.ipynb_checkpoints | ||
71 | + | ||
72 | +# pyenv | ||
73 | +.python-version | ||
74 | + | ||
75 | +# celery beat schedule file | ||
76 | +celerybeat-schedule | ||
77 | + | ||
78 | +# dotenv | ||
79 | +.env | ||
80 | + | ||
81 | +# virtualenv | ||
82 | +venv/ | ||
83 | +ENV/ | ||
84 | + | ||
85 | +# Spyder project settings | ||
86 | +.spyderproject | ||
87 | + | ||
88 | +# Rope project settings | ||
89 | +.ropeproject | ||
90 | + | ||
91 | +# PhpStorm project | ||
92 | +.idea |
Key-6.dat
0 → 100755
No preview for this file type
__init__.py
0 → 100755
playtender.robot
0 → 100755
This diff could not be displayed because it is too large.
playtender_service.py
0 → 100755
1 | +# -*- coding: utf-8 - | ||
2 | +from iso8601 import parse_date | ||
3 | +from datetime import datetime | ||
4 | +from robot.libraries.BuiltIn import BuiltIn | ||
5 | +from robot.output import librarylogger | ||
6 | +import urllib | ||
7 | +import urllib3 | ||
8 | + | ||
9 | +def get_library(): | ||
10 | + return BuiltIn().get_library_instance('Selenium2Library') | ||
11 | + | ||
12 | + | ||
13 | +def get_webdriver_instance(): | ||
14 | + return get_library()._current_browser() | ||
15 | + | ||
16 | + | ||
17 | +def convert_datetime_for_delivery(isodate): | ||
18 | + iso_dt = parse_date(isodate) | ||
19 | + date_string = iso_dt.strftime("%Y-%m-%d %H:%M") | ||
20 | + return date_string | ||
21 | + | ||
22 | +def convert_isodate_to_site_date(isodate): | ||
23 | + iso_dt = parse_date(isodate) | ||
24 | + date_string = iso_dt.strftime("%d.%m.%Y") | ||
25 | + return date_string | ||
26 | + | ||
27 | +def convert_isodate_to_site_datetime(isodate): | ||
28 | + iso_dt = parse_date(isodate) | ||
29 | + date_string = iso_dt.strftime("%d.%m.%Y %H:%M") | ||
30 | + return date_string | ||
31 | + | ||
32 | +def convert_date_for_compare(datestr): | ||
33 | + return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M") | ||
34 | + | ||
35 | + | ||
36 | +def procuring_entity_name(tender_data): | ||
37 | + tender_data.data.procuringEntity['name'] = u"ТОВ \"ПлейТендер\"" | ||
38 | + tender_data.data.procuringEntity['name_en'] = u"TOV \"playtender\"" | ||
39 | + tender_data.data.procuringEntity.identifier['id'] = u"1234567890" | ||
40 | + tender_data.data.procuringEntity.identifier['legalName'] = u"ТОВ \"ПлейТендер\"" | ||
41 | + tender_data.data.procuringEntity.identifier['legalName_en'] = u"TOV \"playtender\"" | ||
42 | + tender_data.data.procuringEntity.address['region'] = u"Житомирська область" | ||
43 | + tender_data.data.procuringEntity.address['postalCode'] = u"123123" | ||
44 | + tender_data.data.procuringEntity.address['locality'] = u"населений пункт" | ||
45 | + tender_data.data.procuringEntity.address['streetAddress'] = u"адреса" | ||
46 | + tender_data.data.procuringEntity.contactPoint['name'] = u"Замовник Тест" | ||
47 | + tender_data.data.procuringEntity.contactPoint['name_en'] = u"Test" | ||
48 | + tender_data.data.procuringEntity.contactPoint['email'] = u"zamovnuk@rambler.ru" | ||
49 | + tender_data.data.procuringEntity.contactPoint['telephone'] = u"+3801111111111" | ||
50 | + tender_data.data.procuringEntity.contactPoint['url'] = u"http://playtender.com.ua" | ||
51 | + return tender_data | ||
52 | + | ||
53 | +def split_take_item(value, separator, index): | ||
54 | + librarylogger.console('split_take_item') | ||
55 | + librarylogger.console(value) | ||
56 | + librarylogger.console(separator) | ||
57 | + librarylogger.console(index) | ||
58 | + return value.split(separator)[int(index)] | ||
59 | + | ||
60 | + | ||
61 | +def split_take_slice(value, separator, _from=None, to=None): | ||
62 | + librarylogger.console(value) | ||
63 | + librarylogger.console(separator) | ||
64 | + librarylogger.console(_from) | ||
65 | + librarylogger.console(to) | ||
66 | + l = value.split(separator) | ||
67 | + if to: | ||
68 | + l = l[:int(to)] | ||
69 | + if _from: | ||
70 | + l = l[int(_from):] | ||
71 | + return l | ||
72 | + | ||
73 | +def split_take_slice_from(value, separator, _from): | ||
74 | + librarylogger.console('split_take_slice_from') | ||
75 | + return split_take_slice(value, separator, _from) | ||
76 | + | ||
77 | +def split_take_slice_to(value, separator, to): | ||
78 | + librarylogger.console('split_take_slice_to') | ||
79 | + return split_take_slice(value, separator, to=to) | ||
80 | + | ||
81 | +def join(l, separator): | ||
82 | + librarylogger.console('join') | ||
83 | + librarylogger.console(l) | ||
84 | + return separator.join(l) | ||
85 | + | ||
86 | + | ||
87 | +def get_invisible_text(locator): | ||
88 | + element = get_library()._element_find(locator, False, True) | ||
89 | + text = get_webdriver_instance().execute_script('return jQuery(arguments[0]).text();', element) | ||
90 | + return text | ||
91 | + | ||
92 | + | ||
93 | +def get_text_excluding_children(locator): | ||
94 | + element = get_library()._element_find(locator, False, True) | ||
95 | + text = get_webdriver_instance().execute_script(""" | ||
96 | + return jQuery(arguments[0]).contents().filter(function() { | ||
97 | + return this.nodeType == Node.TEXT_NODE; | ||
98 | + }).text(); | ||
99 | + """, element) | ||
100 | + return text.strip() | ||
101 | + | ||
102 | +def convert_float_to_string(number): | ||
103 | + return format(number, '.2f') | ||
104 | + | ||
105 | +def convert_date_for_compare_ex(datestr): | ||
106 | + return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M+02:00") | ||
107 | + | ||
108 | +def convert_date_for_compare_ex2(datestr): | ||
109 | + return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M+02:00") | ||
110 | + | ||
111 | +def download_file(url, file_name, output_dir): | ||
112 | + urllib.urlretrieve(url, ('{}/{}'.format(output_dir, file_name))) | ||
113 | + | ||
114 | +def multiply_hundred(number): | ||
115 | + return number*100 | ||
116 | + | ||
117 | +def inject_urllib3(): | ||
118 | + import urllib3.contrib.pyopenssl | ||
119 | + urllib3.contrib.pyopenssl.inject_into_urllib3() | ||
120 | + |
setup.py
0 → 100755
1 | +from setuptools import setup | ||
2 | + | ||
3 | +broker_name = 'playtender' | ||
4 | +pkg_name = 'robot_tests.broker.{}'.format(broker_name) | ||
5 | + | ||
6 | +setup(name=pkg_name, | ||
7 | + version='0.0.dev1', | ||
8 | + description='{} broker for OpenProcurement Robot tests'.format(broker_name), | ||
9 | + author='', | ||
10 | + author_email='', | ||
11 | + url='https://github.com/openprocurement/{}'.format(pkg_name), | ||
12 | + packages=[pkg_name], | ||
13 | + package_dir={pkg_name: '.'}, | ||
14 | + package_data={pkg_name: ['*.robot']} | ||
15 | + ) |
Please
register
or
login
to post a comment