-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from ProzorroUKR/frameworkagreement
Framework Agreement
- Loading branch information
Showing
15 changed files
with
395 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
image: alpine | ||
before_script: | ||
- eval `ssh-agent -s` && ssh-add | ||
- sh bootstrap.sh | ||
- bin/buildout -N | ||
stages: | ||
- test | ||
|
||
test_sanbox_true: | ||
stage: test | ||
variables: | ||
SANDBOX_MODE: 'True' | ||
script: | ||
- bin/py.test ./src/openprocurement/api/tests/ --cov=openprocurement.api | ||
|
||
|
||
test_sanbox_not_true: | ||
stage: test | ||
variables: | ||
SANDBOX_MODE: '' | ||
script: | ||
- bin/py.test ./src/openprocurement/api/tests/ --cov=openprocurement.api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
virtualenv --clear . | ||
./bin/pip install setuptools==7.0 | ||
./bin/pip install zc.buildout==2.2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,7 @@ dependent-scripts = true | |
eggs = | ||
openprocurement.api [test] | ||
nose | ||
pytest | ||
pytest-cov | ||
# pylint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
python_files = tests/*.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
import os, sys | ||
import csv | ||
|
||
def get_fields_name(cls): | ||
fields_name = set(cls._fields._keys) | ||
fields_name.update(cls._serializables.keys()) | ||
return fields_name | ||
|
||
|
||
def get_roles_from_object(cls): | ||
fields_name = get_fields_name(cls) | ||
roles_keys = [role_name for role_name in cls._options.roles] | ||
roles = {} | ||
for role_name in roles_keys: | ||
rr = cls._options.roles[role_name] | ||
roles[role_name] = set([i for i in list(fields_name) if not rr(i, '')]) | ||
return roles | ||
|
||
|
||
def create_csv_roles(cls): | ||
roles = get_roles_from_object(cls) | ||
fields_name = list(get_fields_name(cls)) | ||
path_role_csv = '' | ||
for i in os.path.abspath(sys.modules[cls.__module__].__file__).split('/')[:-1]: | ||
path_role_csv += (i + '/') | ||
with open('{0}{1}.csv'.format(path_role_csv, cls.__name__), 'wb') as csvfile: | ||
fields_name.insert(0, 'rolename') | ||
writer = csv.DictWriter(csvfile, fieldnames=fields_name) | ||
writer.writeheader() | ||
writer = csv.writer(csvfile) | ||
for role_name in roles: | ||
row = [role_name] | ||
for field_name in fields_name[1:]: | ||
if field_name in roles[role_name]: | ||
row.append('1') | ||
else: | ||
row.append('') | ||
writer.writerow(row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
from schematics.transforms import export_loop, whitelist | ||
import csv, os | ||
|
||
|
||
class RolesFromCsv(dict): | ||
|
||
def __init__(self, path, relative_to=__file__): | ||
super(RolesFromCsv, self).__init__(()) | ||
self.base_dir = os.path.dirname(os.path.abspath(relative_to)) | ||
with open(os.path.join(self.base_dir, path)) as csvfile: | ||
reader = csv.DictReader(csvfile) | ||
for row in reader: | ||
self[row['rolename']] = whitelist(*[k for k in row if k != 'rolename' and row[k]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.