Skip to content

Instantly share code, notes, and snippets.

@GabiThume
GabiThume / environment.py
Last active August 4, 2018 15:51
A simple test using behave and selenium
from selenium import webdriver
def before_all(context):
context.browser = webdriver.Firefox()
def after_all(context):
context.browser.quit()

Information Packets (IP)

Primary properties

Improve markdown of this section

Optional properties

Instead of just 'scope - see scope', add some information about scope and then '(for more information, see scope)' for instance.

Ports API

model = models.TCBS
api = model()
def mocked_get(**options):
assert 'crashes/signatures' in options['url']
# expect no os_name parameter encoded in the URL
assert '/os/' not in options['url']
return Response("""
{"crashes": [],
"totalPercentage": 0,
"start_date": "2013-05-10",
INSERT INTO raw_crashes (uuid, raw_crash, date_processed) VALUES (12dd97c3-6459-a77f-f474-edb8f0130910, { "uuid": "12dd97c3-6459-a77f-f474-edb8f0130910", "IsGarbageCollecting": "1" }, 2013-09-10 19:51:18.377914)
INSERT INTO raw_crashes (uuid, raw_crash, date_processed) VALUES (c02cb7f1-f051-d5f6-db21-f340c0130910, { "uuid": "c02cb7f1-f051-d5f6-db21-f340c0130910", "IsGarbageCollecting": "1" }, 2013-09-10 19:51:18.377914)
INSERT INTO raw_crashes (uuid, raw_crash, date_processed) VALUES (60597bdc-5dbe-4409-6b38-4309c0130909, { "uuid": "60597bdc-5dbe-4409-6b38-4309c0130909", "IsGarbageCollecting": "1" }, 2013-09-09 19:52:38.070392)
E
======================================================================
ERROR: testx (socorro.unittest.external.postgresql.test_backfill.TestBackfill)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gabi/Desktop/CODE/src/socorro/socorro/unittest/external/postgresql/test_backfill.py", line 51, in setUp
cursor.e
socorro./aux/.200
socorro./aux/age/.200
socorro./aux/gender/.200
socorro./aux/misconfigured/.405
socorro./aux/foo/bar/names/peter+anders.200
socorro./aux/.200
socorro./aux/.405
socorro./aux/bla.500
socorro./aux/.200
socorro./backfill/backfill_type/adu/update_day/2013-08-22/.200
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
from socorro.external.postgresql.backfill import Backfill
from nose.plugins.attrib import attr
from .unittestbase import PostgreSQLTestCase
from socorro.lib import datetimeutil
from socorro.external.postgresql import fakedata
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from socorro.external.postgresql.base import PostgreSQLBase
from socorro.lib import external_common
import socorro.database.database as db
from socorro.external import MissingOrBadArgumentError
@GabiThume
GabiThume / gist:6118039
Created July 30, 2013 23:39
add test for crontabber_state_json() view -- bug 888952
@mock.patch('requests.get')
def test_crontabber_state_json(self, rget):
url = reverse('crashstats.crontabber_state_json')
def mocked_get(**options):
assert 'crontabber_state' in options['url']
return Response("""
{
"state": {
"slow-one": {
@GabiThume
GabiThume / gist:6118035
Created July 30, 2013 23:38
add test for crontabber_state_json() view -- bug 888952
@mock.patch('requests.get')
def test_crontabber_state_json(self, rget):
url = reverse('crashstats.crontabber_state_json')
def mocked_get(**options):
assert 'crontabber_state' in options['url']
return Response("""
{
"state": {
"slow-one": {
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import unittest
import mock
import time
import json
from socorro.collector.submitter_app import (