Skip to content

Instantly share code, notes, and snippets.

View omaciel's full-sized avatar
🎯
Learning

Og Maciel omaciel

🎯
Learning
View GitHub Profile
my_file = open('ダウンロード/og-cfse-2.zip')
lines = []
boundary = '----------BOUNDARY_$'
lines.append('--' + boundary)
lines.append('Content-Disposition: form-data; name="foo"; filename="%s"' % my_file.name)
content = my_file.read()
lines.append(content)
lines.append('--' + boundary + '--')
'\r\n'.join(lines)
@omaciel
omaciel / mangonel_me.sh
Created August 30, 2013 22:17
Run mangonel using a virtual environment
yum install -y git python-pip
pip-python install virtualenvwrapper
export WORKON_HOME=~/.
source /usr/bin/virtualenvwrapper.sh
rm -rf /root/mangonel/ && git clone https://github.com/omaciel/mangonel.git /root/mangonel
rm -rf /root/katello-cli && git clone https://github.com/Katello/katello-cli.git /root/katello-cli
mkvirtualenv mangonel
cd /root/katello-cli
env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" pip install -r requirements.pip
@omaciel
omaciel / sam_stress.csv
Last active December 22, 2015 02:09
Stress test results for SAM
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
RELEASE: 1.3
DATE: 2013-09-25
Organizations
-------------
200 0.566021 0.267278 0.138487 0.090077 0.086591 2.69
Systems
-------
200 1.340439 0.73645 0.340358 0.272603 0.273094 4.29
@omaciel
omaciel / report.py
Last active December 22, 2015 18:39
from scout import *
import argparse
import sys
JENKINS_BRN = 'http://smqa-r210-01.lab.eng.brq.redhat.com:8080/job'
JENKINS_RDU = 'http://hudson.rhq.lab.eng.bos.redhat.com:8080/hudson/job'
PLAN_COVERAGE = [
{'name': 'katello-api-pyCoverage', 'url': JENKINS_BRN},
import argparse
import boto.ec2
import os
import paramiko
import sys
import tempfile
import time
from urllib import urlopen
@omaciel
omaciel / firefox_webdriver.py
Created November 10, 2013 16:40
Starts up Firefox using a language locale
from selenium import webdriver
profile = webdriver.firefox.firefox_profile.FirefoxProfile()
profile.set_preference("intl.accept_languages", "fr")
browser = webdriver.Firefox(profile)
browser.get("http://google.com")
@omaciel
omaciel / chrome_webdriver.py
Created November 11, 2013 18:05
Starts up Google Chrome using a language locale.
from selenium import webdriver
capabilities = webdriver.chrome.options.DesiredCapabilities.CHROME
capabilities["intl.accept_languages"] = "fr"
options = webdriver.chrome.options.Options()
options.add_experimental_option("intl.accept_languages", "fr")
driver = webdriver.Chrome(desired_capabilities=capabilities)
driver = webdriver.Chrome(chrome_options=options)
@omaciel
omaciel / gist:7484744
Created November 15, 2013 14:03
Patch for getting a localized Firefox
diff --git a/tests/ui/baseui.py b/tests/ui/baseui.py
index 7dd47a1..f84551a 100644
--- a/tests/ui/baseui.py
+++ b/tests/ui/baseui.py
@@ -42,9 +42,16 @@ class BaseUI(unittest.TestCase):
self.logger = logging.getLogger("robottelo")
self.logger.setLevel(self.verbosity * 10)
+ # This only works for Firefox
+ if self.driver_name.lower() == 'firefox':
@omaciel
omaciel / gist:7569869
Last active December 28, 2015 22:09
Moving around Foreman's menus
import lib.ui.login
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
browser = webdriver.Firefox()
browser.get("https://qetello01.usersys.redhat.com")
login = lib.ui.login.Login(browser)
login.login('admin', 'changeme')
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: ts=4 sw=4 expandtab ai
from base import Base
from lib.common.helpers import csv_to_dictionary
class Org(Base):