Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit e50681cf authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Carleski

parent 6dad7fc0
---
image: python:3.7
stages:
- test
test:
stage: test
before_script:
- pip install virtualenv
- ./init.sh
- export PATH=./tests:$PATH
script:
- ./venv/bin/python setup.py test
......@@ -10,7 +10,7 @@ import yaml
from datetime import datetime
from datetime import timedelta
from multiprocessing import Process
from subprocess import check_output as cmd
from subprocess import check_output
from subprocess import CalledProcessError
from os.path import exists
from os import makedirs
......@@ -45,7 +45,7 @@ class Archiver():
def log_users(self):
for i in range(5):
try:
userData = cmd([
userData = check_output([
self.config['google']['gam_command'],
'print',
'users',
......@@ -83,7 +83,7 @@ class Archiver():
def log_groups(self):
for i in range(5):
try:
groupData = cmd([
groupData = check_output([
self.config['google']['gam_command'],
'print',
'groups',
......@@ -125,7 +125,7 @@ class Archiver():
def log_resources(self):
for i in range(5):
try:
resourceData = cmd([
resourceData = check_output([
self.config['google']['gam_command'],
'print',
'resources'
......@@ -166,7 +166,7 @@ class Archiver():
def log_oauth(self):
for i in range(5):
try:
oauthData = cmd([
oauthData = check_output([
self.config['google']['gam_command'],
'report',
'token',
......@@ -242,7 +242,7 @@ class Archiver():
for i in range(5):
try:
loginData = cmd([
loginData = check_output([
self.config['google']['gam_command'],
'report',
'login',
......@@ -307,7 +307,7 @@ class Archiver():
exit(2)
for i in range(5):
try:
cmd([
check_output([
self.config['google']['gam_command'],
'user',
self.config['google']['admin_account'],
......@@ -333,7 +333,7 @@ class Archiver():
def create_google_report_directory(self):
try:
# Ensure top-level reports directory exists.
top_level_check = cmd([
top_level_check = check_output([
self.config['google']['gam_command'],
'user',
self.config['google']['admin_account'],
......@@ -345,7 +345,7 @@ class Archiver():
print(top_level_check)
if len(top_level_check.split('\n')) <= 2:
results = cmd([
results = check_output([
self.config['google']['gam_command'],
'user',
self.config['google']['admin_account'],
......@@ -363,7 +363,7 @@ class Archiver():
parent_id = re.findall(regex, top_level_check)[0]
# Ensure today's report directory exists.
log_dir_check = cmd([
log_dir_check = check_output([
self.config['google']['gam_command'],
'user',
self.config['google']['admin_account'],
......@@ -376,7 +376,7 @@ class Archiver():
)
]).decode('UTF-8')
if len(log_dir_check.split('\n')) <= 2:
results = cmd([
results = check_output([
self.config['google']['gam_command'],
'user',
self.config['google']['admin_account'],
......
......@@ -619,7 +619,7 @@ def main():
for i in range(5):
_classes_met = 0
_pool = ''.join(char_pool)
args.password = ''.join(choice(_pool) for i in range(12))
args.password = ''.join(choice(_pool) for i in range(16))
for char_class in char_pool:
try:
assert set(args.password).intersection(set(char_class))
......
......@@ -5,7 +5,7 @@ import logging
import logging.handlers
from .core import arg_prompt
from subprocess import check_output as cmd
from subprocess import check_output
from subprocess import CalledProcessError
......@@ -17,9 +17,6 @@ class Account():
self.logger = logging.getLogger(__name__)
self.localpart = self.account.split('@')[0]
if self.start_at == 1:
self.total += 1
self.count = ("{0:03}".format(i) for i in range(
self.start_at,
self.start_at + self.total
......@@ -28,7 +25,7 @@ class Account():
# Verify that the subject user exists.
try:
cmd([
check_output([
config['google']['gam_command'],
'whatis',
self.account
......@@ -52,14 +49,14 @@ class Account():
)
try:
cmd([
check_output([
self.config['google']['gam_command'],
'user',
self.account,
'label',
label
])
cmd([
check_output([
self.config['google']['gam_command'],
'user',
self.account,
......
......@@ -308,7 +308,7 @@ def main():
for i in range(5):
_classes_met = 0
_pool = ''.join(char_pool)
args.password = ''.join(choice(_pool) for i in range(12))
args.password = ''.join(choice(_pool) for i in range(16))
for char_class in char_pool:
try:
assert set(args.password).intersection(set(char_class))
......
import pytest
import json
import os
from unittest import mock
pytest_plugins = ("pep8")
@pytest.fixture
def fileloader():
host_dir = os.path.join(os.path.dirname(__file__))
def _loader(service, filenames):
data_dir = host_dir + '/data/{}/'.format(service)
for fname in filenames:
with open(data_dir + fname + '.txt', 'r') as f:
data = f.read()
print(data)
yield data.encode('UTF-8')
# @mock.patch('subprocess.check_output')
# def _gam(json_files, gam):
# print('Step one: load "'+ str(json_files) + '"')
# gam.side_effect = _loader(json_files)
# print(gam.return_value)
# return gam
return _loader
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment