Skip to content

Instantly share code, notes, and snippets.

View AdamSaleh's full-sized avatar

Adam Saleh AdamSaleh

View GitHub Profile
@AdamSaleh
AdamSaleh / gist:6038484
Created July 19, 2013 11:27
Data driven
I think you can generate the data something like this
(def data-include-exclude
[[true "Exclude Errata: %s" "Exclude Errata: RHBA, RHSA" "Exclude Errata: Enhancement: 2013-07-02 - 2013-07-03"]
[false "Include Errata: %s" "Include Errata: RHBA, RHSA" "Include Errata: Enhancement: 2013-07-02 - 2013-07-03"]])
(def data-dates [["07/02/2013" "07/03/2013"]
["07/02/2014" "07/03/2014"]])
(def data (for [incl-excl data-include-exclude
I open lein repl and:
katello.tests.content-search=> (ns katello.organizations)
nil
katello.organizations=> (browser fireEvent ::ui/switcher "click")
SeleniumException ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window. The error message is: Value does not implement interface Event. com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError (HttpCommandProcessor.java:112)
katello.organizations=> (pst 100)
@AdamSaleh
AdamSaleh / gist:6199417
Created August 10, 2013 07:06
many-to-many yesod
Thing
title Text
description Text
Tag
title Text
TagAThing
thing ThingId
tag TagId
#<ExceptionInfo clojure.lang.ExceptionInfo: clj-http: status 404 {:object {:trace-redirects ["https://10-16-6-158.rhq.lab.eng.bos.redhat.com/katello//api/content_view_definitions"], :request-time 1295, :status 404, :headers {"x-ua-compatible" "IE=Edge,chrome=1", "x-rack-cache" "invalidate, pass", "server" "thin 1.3.1 codename Triple Espresso", "x-runtime" "0.017192", "content-type" "application/json; charset=utf-8", "x-request-id" "2a8a7124ee878e271d9b7d4676fb7a88", "date" "Mon, 30 Sep 2013 15:58:49 GMT", "cache-control" "no-cache", "transfer-encoding" "chunked", "x-candlepin-version" "katello/1.4.8-1.git.10.269ae16.el6", ...}, :body "{\"displayMessage\":\"Resource not found on the server\",\"errors\":[\"Not found\"]}"}, :environment {client #<client$wrap_output_coercion$fn__8485 clj_http.client$wrap_output_coercion$fn__8485@5108e39e>, req {:headers {"accept" "application/json", "content-type" "application/json"}, :request-method :post, :url "https://10-16-6-158.rhq.lab.eng.bos.redhat.com/katello//api/content
(defn rest-publish
"Publishes a Content View Definition"
[{:keys [cv published-name description]} & [timeout-ms]]
(let [resolv-id #(-> % rest/read rest/id)
id-org-publish-uri (partial rest/url-maker [["api/organizations/%s/content_view_definitions/%s/publish" [:org identity]]])]
(rest/http-put (id-org-publish-uri cv)
{:body {:name published-name
:id (-> cv resolv-id)
:description description}})))
Debug: [Trying to look up package from ceylon.language.package]
Debug: [Failed to complete ceylon.language.package]
Debug: [Trying to look up module from ceylon.language.module]
Debug: Looking for com.redhat.ceylon.common-0.6.1(.car|.jar)
Debug: Trying repository /usr/lib/ceylon/0.6/repo
Debug: -> Found at /com/redhat/ceylon/common/0.6.1/com.redhat.ceylon.common-0.6.1.jar
ceylon run: Invalid SHA1 for artifact: com.redhat.ceylon.common-0.6.1(.car|.jar)
com.redhat.ceylon.cmr.impl.InvalidArchiveException: Invalid SHA1 for artifact: com.redhat.ceylon.common-0.6.1(.car|.jar)
at com.redhat.ceylon.cmr.impl.AbstractNodeRepositoryManager.getLeafNode(AbstractNodeRepositoryManager.java:280)
at com.redhat.ceylon.cmr.impl.RootRepositoryManager.getArtifactResult(RootRepositoryManager.java:64)
error [method or attribute does not exist: random in type unknown] at 9:26-9:36 of ceylon/examples/gameoflife/web/run.ceylon
error [value type could not be inferred] at 11:8-11:12 of ceylon/examples/gameoflife/web/run.ceylon
error [cannot find module source artifact java.base-7.src
- dependency tree: ceylon.examples.gameoflife/1.0.0 -> java.base/7] at 2:4-2:24 of ceylon/examples/gameoflife/module.ceylon
error [cannot find module source artifact java.base-7.src
- dependency tree: test.examples.gameoflife/1.0.0 -> ceylon.examples.gameoflife/1.0.0 -> java.base/7] at 2:4-2:24 of ceylon/examples/gameoflife/module.ceylon
error [cannot find module source artifact java.desktop-7.src
- dependency tree: ceylon.examples.gameoflife/1.0.0 -> java.desktop/7] at 3:4-3:27 of ceylon/examples/gameoflife/module.ceylon
error [cannot find module source artifact java.desktop-7.src
- dependency tree: test.examples.gameoflife/1.0.0 -> ceylon.examples.gameoflife/1.0.0 -> java.desktop/7] at 3:4-3:27 of ceylon/examples/gameoflife/m
(defn read-it
"Tries to read a role based on the name"
[role]
(let [get-list (fn []
(->>
(browser/find-elements {:xpath "//div[@id='roles_tree']//ul[@class='filterable']//li"})
(map browser/text)
(remove #(or (= "Permissions" %) (= "Users" %) (empty? %)))))
user-names (do
(nav/go-to role)
@AdamSaleh
AdamSaleh / gist:7945116
Created December 13, 2013 14:33
Mixin api request
from lib.api.base as base
class ApiCrud:
@classmethod
def api_path(cls):
pass
@classmethod
def parse_path_arg(cls, args):
path = cls.api_path()
@AdamSaleh
AdamSaleh / gist:7945132
Created December 13, 2013 14:33
Definition of user api
from apicrud import ApiCrud
class UserApi(ApiCrud):
@classmethod
def api_path(cls):
return "/api/users/"